timepicker-ui
4.6.0GitHub
timepicker-ui
Themes / Dark Mode

Dark Mode

Force a light or dark picker, or let it follow the page. This page documents @pglejzer/datepicker-ui, the companion of timepicker-ui.

Dark

#

ui.colorScheme: "dark" forces the dark version of the theme, whatever the page looks like. Use the Inline switch to see the calendar in place.

dark
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
ui: { colorScheme: "dark" },
}).create();

Light

#

"light" forces the light version, even on a dark page.

light
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
ui: { colorScheme: "light" },
}).create();

Auto

#

"auto" is the default. The scheme is detected when the picker opens. The first mostly opaque background-color on the input or one of its ancestors decides, and a low luminance means dark. Without one, the page color-scheme decides: dark is dark, light dark follows the operating system, and anything else is light. An inline picker detects again when the page changes.

auto
import DatepickerUI from "@pglejzer/datepicker-ui";
import "@pglejzer/datepicker-ui/index.css";
new DatepickerUI("#date", {
ui: { colorScheme: "auto" },
}).create();

Note

Only basic and blueprint have a light and a dark version. The other themes keep their own scheme and ignore colorScheme. The demos on this site pick the scheme from the site theme when a demo does not set one.
Esc