Display the current lunar phase as ASCII art.
Project description
ascii-moon-phase-python
Prints the current moon phase as ASCII art. Install with pip install ascii-moon-phase and run with python3 -m ascii_moon_phase.
usage: ascii-moon [-h] [--size SIZE] [--hemisphere {north,south}] [--date DATE] [--phase PHASE] [--light-char CHAR]
[--dark-char CHAR] [--empty-char CHAR] [--show-phase]
Render the lunar phase as filled ASCII art.
options:
-h, --help show this help message and exit
--size SIZE Height in rows (width is 2*size). Default: 24
--hemisphere {north,south}
Orientation: 'north' shows waxing on the right (default).
--date DATE Calendar date YYYY-MM-DD (default: today).
--phase PHASE Phase fraction in [0.0, 1.0]; 0.0=new, 0.5=full, 1.0=new. Overrides --date.
--light-char CHAR Character for illuminated area (default: '@').
--dark-char CHAR Character for dark area (default: '.').
--empty-char CHAR Character outside the disc (default: space).
--show-phase Print the numeric phase after the art.
You can also call these functions from Python:
>>> import ascii_moon_phase as amp
>>> print(amp.render_moon())
...@@@@@@@@@@@
.....@@@@@@@@@@@@@@@@@@@
.......@@@@@@@@@@@@@@@@@@@@@@@
.......@@@@@@@@@@@@@@@@@@@@@@@@@@@
........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
..........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
........@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.......@@@@@@@@@@@@@@@@@@@@@@@@@@@
.......@@@@@@@@@@@@@@@@@@@@@@@
.....@@@@@@@@@@@@@@@@@@@
...@@@@@@@@@@@
The parameters of render_moon() are:
def render_moon(
size: int = 24,
northern_hemisphere: bool = True,
phase_date: date | None = None,
light_char: str = "@",
dark_char: str = ".",
empty_char: str = " ",
phase: float | None = None,
) -> str:
You can also call animate_phases() to play a smooth animation of the moon, or call animate_future() to show the phase of each day progressing into the future.
The Rust version is at https://github.com/asweigart/ascii-moon-phase-rust
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ascii_moon_phase-0.3.0.tar.gz.
File metadata
- Download URL: ascii_moon_phase-0.3.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63dcd9e88b21f46d05fb20ccf27b7529b42c6854d3c1fae172a27a6c6a41da52
|
|
| MD5 |
a4b17330aab653a49d6d7913c818749b
|
|
| BLAKE2b-256 |
56cdf59975754195d71f5ceacd584c6c328f6452a873bb028f12a7095bb03d65
|
File details
Details for the file ascii_moon_phase-0.3.0-py3-none-any.whl.
File metadata
- Download URL: ascii_moon_phase-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fde5a1240805fbe5c29023401c0d9d5be2380ae825b8ac6c4a3f317f040198dd
|
|
| MD5 |
5494cd9f1124415c650c7b915bc37980
|
|
| BLAKE2b-256 |
91b08115c371916f974f6916cd4b26493708aa4b04a8d88a86ad978f3d4ae96a
|