Skip to content

theme

The calendar’s family of colours, ready-made or your own.

Typestring
Default'standard'
Live update (update())Yes
Declared inpackages/dom/src/calendar.ts

Seven ready-made families come with the stylesheet @dzcalendar/theme (import '@dzcalendar/theme/dzcalendar.css'): 'standard', 'slate', 'night', 'pastel', 'frost', 'solar' and 'contrast' — each with its light and dark side (scheme). defineTheme(name, tokens) (@dzcalendar/dom) makes one of yours from a palette (bg, fg, accent, border, radius, font…), the calendar’s own tokens (todayBg, now, eventBg…) and named event tones — each colour one value or [light, dark] (radius and font one value). The ready-made names need the stylesheet imported; defineTheme refuses (a RangeError) a ready-made name, an unknown token or an unsafe value.

The palette is tzslot’s too (--tz-*): a page that sets it themes the calendar and tzslot’s pickers at once, and a page’s own --tz-* and --dz-* variables win over any family. A name that is neither ready-made nor defined throws a RangeError.

import '@dzcalendar/theme/dzcalendar.css';
import { createCalendar, defineTheme } from '@dzcalendar/dom';
// A family of the clinic's own: its green, each side its own.
defineTheme('clinic', { accent: ['#0f766e', '#2dd4bf'], todayBg: ['#f0fdfa', '#042f2e'], tones: { urgent: '#b91c1c' } });
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', theme: 'clinic' });
// Later: a ready-made one.
calendar.update({ theme: 'slate' });

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

The same week in the night family, drawn dark (scheme: 'dark').