Sun card: moon-phase view after sunset — v0.17.0 - #34
Merged
Conversation
Refactor prism-sun-card to keep the daytime sun-path arc unchanged (extracted into _sunView) and add a night moon view (_moonView), shown after sunset when the new `show_moon` option is on and a moon-phase sensor is available. The moon view draws a moon-phase glyph to the current illuminated fraction (moonLitPath: outer semicircle on the lit side + a terminator half-ellipse; waxing lights the right, new = unlit, full = full circle), plus illumination % (from an optional sensor, else computed from the phase), the phase name, the next sunrise, and a moonrise/moonset row when those sensors are configured. New config: show_moon (default true), moon_entity (default sensor.moon), moonrise_entity, moonset_entity, moon_illumination_entity. Editor gains a Moon section. Colours are theme-safe and moon elements use the secondary text colour rather than the accent. Wired smoke (night + moon fixtures, 2 cases) and preview (Sun & Moon demo); updated README + docs/cards.md. Verified in Chromium across all 8 phases. VERSION 0.16.5 -> 0.17.0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014cpNPVU8j1iiU9CnXgr5JY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The sun card keeps its daytime sun-path arc, and now after sunset it flips to a moon view:
Behaviour
_sunView, unchanged).below_horizon/ elevation ≤ 0) → the moon view, whenshow_moonis on (default) and a moon-phase sensor is available. Otherwise the arc rests with a moon on the horizon as before.Config (new)
show_moontruemoon_entitysensor.moonmoonrise_entitymoonset_entitymoon_illumination_entityThe editor gains a Moon section (switch + four pickers). Moon colours are theme-safe (silver lit path + secondary-text outline), and moon icons use the secondary text colour rather than the accent so the moon reads distinctly from the sun.
Implementation note
moonLitPath(cx, cy, r, k)renders the lit region as an outer semicircle on the lit side plus a terminator half-ellipse of x-radius|cos(2πk)|·r(waxing lights the right; new moon = nothing lit, full = full circle).moonInfo()maps the 8 HA phase names (or a numeric phase) to{label, k}.Testing
bash build.sh+node test/smoke.jsgreen (added a night + moon fixture and 2 cases). Preview gains a "Sun & Moon" demo, so the showcase picks it up.VERSION 0.16.5 → 0.17.0.
🤖 Generated with Claude Code
Generated by Claude Code