Skip to main content

Module mode

Module mode 

Source
Expand description

Light and dark, read once for both halves of the page.

The chrome is Tailwind and the diagram is the app’s palette, but which end of the axis each is drawn at is one reading: the class the root carries and the Palette the kernel is told come from the same answer, so the bar and the ground cannot disagree. The preference itself is blockworx_paint::Mode, kept in crate::prefs; what is here is the browser’s own answer and the class the chrome varies on.

Enums§

Prefers
What the browser answers for prefers-color-scheme: dark. Unstated is an engine that does not answer the query at all, which is not the same as answering “light”.

Constants§

DARK 🔒
The query Mode::System follows.

Functions§

luminance
Which end of the axis the page is drawn at.
root_class
The class the root element carries so Tailwind’s dark: variant applies — tailwind.css keys that variant off the class rather than the media query, which is what lets one reading drive both halves.
watch
Follow the system preference for as long as the page is open: told is called whenever the browser changes its mind, which is what keeps Mode::System actually following rather than sampling once at startup.