Skip to content

Theming ​

Colors, radii, and fonts are CSS custom properties scoped to ._patro — never the global :root — so they can never leak into your app's own styles.

Dark mode ​

Dark is an explicit opt-in, not automatic (it does not follow prefers-color-scheme, since a host app's own theme choice should win). Turn it on with the theme prop, or by setting the attribute yourself on the component or any ancestor:

tsx
<Calendar theme='dark' />

theme='light' keeps one component light inside a dark ancestor.

css
/* equivalent, e.g. if your app's own theme system sets this on <html> */
[data-theme='dark'] { }

Overriding individual tokens ​

Any token can be overridden per instance via style, or globally via your own CSS targeting ._patro. Set tokens on ._patro itself: the component defines every token there, so a value set on :root or another ancestor never reaches it. On a Datepicker, tokens in style reach both the field and its calendar, even in a portal; the rest of style stays on the field.

tsx
<Calendar style={{ '--patro-accent': 'teal' } as React.CSSProperties} />
css
/* globally, for every patro instance in your app */
._patro {
  --patro-accent: teal;
  --patro-radius-cell: 4px;
}

All tokens ​

TokenPurpose
--patro-surfacePopover / input background
--patro-textPrimary text
--patro-mutedWeekday header, labels, placeholder
--patro-secondarySecondary (other-calendar) number
--patro-faint / --patro-faint-secondaryOther months' days
--patro-disabledDays and buttons you can't pick
--patro-hoverCell / button hover background
--patro-border / --patro-border-hoverInput ring
--patro-accentSelection ring, focus ring, links
--patro-todayToday's number when not selected
--patro-weekendweekendDays text color
--patro-dangerinvalid state on Datepicker
--patro-selected-bg / --patro-selected-text / --patro-selected-secondarySelected day
--patro-range-bgRange-mode band between start and end
--patro-haloInput focus ring (outer glow)
--patro-glowSelected-cell glow (mainly visible in dark mode)
--patro-shadowPopover shadow
--patro-radius-popover / --patro-radius-cell / --patro-radius-inputCorner radii
--patro-input-widthDatepicker field width (288px); 100% fills a form column
--patro-fontLatin font stack
--patro-font-devanagariDevanagari font stack

Field width ​

The Datepicker field is --patro-input-width wide, 288px by default. In a form layout, fill the column:

css
.my-form ._patro_datepicker {
  --patro-input-width: 100%;
}

Contrast and high-contrast mode ​

The default text tokens meet WCAG AA (4.5:1) against --patro-surface in both themes; --patro-disabled is deliberately fainter, since disabled days are exempt. If you override colours, keep that ratio for anything people need to read.

In Windows high-contrast mode (forced-colors), the selected day, range band, today marker, focus rings, field borders and invalid state are redrawn with system colours, so they stay visible whatever the user's palette.

Devanagari font ​

For pixel-exact Devanagari numerals, load Noto Sans Devanagari yourself — patro doesn't bundle or auto-inject it (a library forcing a network request or fighting your CSP is an anti-pattern). It falls back to your system sans-serif otherwise.

className / style ​

Both components also accept a plain className and style on their root element, for anything a CSS custom property can't cover.

Released under the MIT License.