ascii-side-of-the-moon 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,10 +15,20 @@ You can use this package directly from the command line:
15
15
  npx ascii-side-of-the-moon
16
16
 
17
17
  # Show moon for a specific date
18
- npx ascii-side-of-the-moon 2025-09-21
18
+ npx ascii-side-of-the-moon 2025-09-19
19
+
20
+ # Include a specific UTC time (quote when using spaces)
21
+ npx ascii-side-of-the-moon "2025-09-19 21:30"
22
+
23
+ # Provide an observer location (latitude/longitude in degrees, optional elevation in meters)
24
+ # (Latitude and longitude are optional, but both must be supplied together;
25
+ # elevation is ignored unless lat/lon are provided.)
26
+ npx ascii-side-of-the-moon 2025-09-19T21:30 --lat 37.7749 --lon -122.4194 --elevation 25
19
27
  ```
20
28
 
21
29
  The CLI will display the ASCII moon art along with information about the moon's phase, illumination percentage, distance, and angular diameter.
30
+ When an observer location is supplied, the renderer also knows the altitude/azimuth
31
+ and can draw the horizon line to show whether the moon is above or below your local horizon.
22
32
 
23
33
  ## Example
24
34
 
@@ -42,11 +52,16 @@ console.log(moonAscii);
42
52
 
43
53
  ## API Reference
44
54
 
45
- ### `getMoonState(date: Date): MoonState`
55
+ ### `getMoonState(date: Date, observer?: ObserverLocation): MoonState`
46
56
  Returns detailed moon information including phase, size, and libration data.
57
+ If you pass an `observer` (latitude/longitude in degrees, optional elevation in meters),
58
+ the returned `MoonState` also contains topocentric position (altitude, azimuth, parallactic angle);
59
+ this enables horizon-aware rendering and correct rotation for your sky.
47
60
 
48
61
  ### `renderMoon(moonState: MoonState, options?: RenderOptions): string`
49
62
  Renders the moon as ASCII art. Returns a 29×60 character string.
63
+ `RenderOptions` now includes `showHorizon` (default `true`): set it to `false`
64
+ if you want to suppress the horizon overlay even when altitude data is available.
50
65
 
51
66
  ### `getMoonPhase(moonState: MoonState): string`
52
67
  Returns the English name of the moon phase (e.g., "New Moon", "Waxing Crescent", "First Quarter", "Waxing Gibbous", "Full Moon", "Waning Gibbous", "Last Quarter", "Waning Crescent").
@@ -62,6 +77,9 @@ pnpm run render:demo 2025-01-01
62
77
  Render an animation:
63
78
  ```sh
64
79
  pnpm run render:demo_animate 2025-01-01 2025-12-30
80
+
81
+ # Include observer coordinates (latitude/longitude degrees, optional elevation meters)
82
+ pnpm run render:demo_animate 2025-07-25 2025-08-23 --lat 37.7749 --lon -122.4194 --elevation 25
65
83
  ```
66
84
 
67
85
  Both demo scripts now include the moon phase name in their output.