Skip to content

scheme

Whether the calendar is drawn light, dark, or as the page is.

Type'auto' | 'light' | 'dark'
Default'auto'
Live update (update())Yes
Declared inpackages/dom/src/calendar.ts
  • 'auto': as the page — the system’s preference (prefers-color-scheme), or a data-theme="light" / "dark" on an ancestor of the calendar (a site’s own switch).
  • 'light', 'dark': that side of the theme, whatever the page.

Every family (theme) has both sides. It changes live: a site’s own light/dark switch passes its value here.

import { createCalendar } from '@dzcalendar/dom';
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', scheme: 'auto' });
// The site's own switch.
document.getElementById('dark-mode')!.addEventListener('change', (e) => calendar.update({ scheme: (e.target as HTMLInputElement).checked ? 'dark' : 'light' }));

In the frameworks it is an Angular input (scheme) and a React and Vue prop (scheme, scheme).

The week drawn dark, whatever the page.