About this set
Theme switches for a light and dark mode setting. Sun to moon is a 76 pixel track with a blue sky: when it is switched on the knob slides across, the sky turns to night, three small stars fade in and the yellow sun becomes a grey crescent moon drawn with an inset shadow. The icon pair is a compact header control showing a sun and a moon glyph with a white disc that slides behind the active one, sized to sit next to navigation links. Use sun to moon where the switch is a feature of the page, such as a settings panel or a hero, and the icon pair in a site header where space is short. Both are a single checkbox with role=”switch” where checked means dark. The CSS only draws state, so wiring it to a real theme is a one-line change listener in your own script, or a :has() rule on the page. In Bootstrap the sun and moon are layered backgrounds on a stock .form-switch.
What’s included
- Sun that turns into a crescent moon as the sky darkens
- Stars that fade in on the night side
- Compact sun and moon icon pair for a header bar
- Deeper sky blue so the track and sun stand out from a light page
- Checked means dark, ready to wire to your theme code
Accessibility
Each switch is a checkbox with role="switch" and the name Dark mode, so assistive technology reads its state as on or off. The sun and moon glyphs are aria-hidden. Tab focuses the control, Space toggles it, and a 2px blue outline marks focus. All transitions stop under prefers-reduced-motion.
Customise it
The sky, night, sun and moon colours are the gradient and background values in .dn i (plain CSS), the SVG fills and gradients on .dn .form-check-input (Bootstrap) or the --color-sky-*, --color-night-*, --color-sun and --color-moon theme colours (Tailwind).






