Skip to content

Theming

@taqwim/themes is a plain CSS package. It knows nothing about any framework — every selector keys off the data-* attributes @taqwim/calendar-core emits, so one stylesheet serves all five adapters.

Rabi' al-awwal 1448
Calendar for Rabi' al-awwal 1448
Markup<div data-taqwim-theme="islamic" data-taqwim-size="default">

One stylesheet is loaded, not thirty-three: switching theme here changes an attribute, which is why several themes can coexist on a page and why the same CSS serves all five adapters. size and layout are orthogonal to it — a theme sets colours, a size sets metrics, a layout sets arrangement.

The theme prop sets data-taqwim-theme on the calendar. Because it is an attribute rather than a stylesheet, several themes can coexist on one page and switching costs a single setAttribute.

<div data-taqwim-theme="islamic">
<!-- any Taqwim calendar -->
</div>

Thirty-three are bundled:

Neutral default · dark · slate · stone · zinc · minimal · minimalist · material

Brand rose · violet · emerald · amber · indigo · teal · crimson · modern · ocean · sunset · nature · neon · cyberpunk · luxurious

Hijri & regional islamic · ramadan · eid · masjid · madinah · andalus · sahara · mihrab · zellige · qamar · najd

size is orthogonal — compact, default, large — and sets data-taqwim-size. A theme sets colours; a size sets metrics; they compose.

Importing @taqwim/themes brings in all thirty-three. To ship one:

import '@taqwim/themes/variables.css'
import '@taqwim/themes/core.css'
import '@taqwim/themes/themes/islamic.css'

variables.css must come before core.css, and themes after both.

Set the tokens you care about under your own attribute value. Anything you leave out falls back to :root.

[data-taqwim-theme='brand'] {
--hc-primary: #6d28d9;
--hc-primary-hover: #5b21b6;
--hc-accent: #ede9fe;
--hc-accent-foreground: #5b21b6;
--hc-border-radius: 1rem;
}

That is all a bundled theme is: about thirty token overrides. Structure lives once in core.css, which contains no literal colour — a test fails the build if one appears.

See the full list under Design tokens.

The preset is generated from variables.css at build time, so the two cannot drift.

/* Tailwind v4 */
@import 'tailwindcss';
@import '@taqwim/themes';
@import '@taqwim/themes/tailwind/theme.css';
/* Tailwind v3, or v4 via @config */
import taqwim from '@taqwim/themes/tailwind'
export default { presets: [taqwim] }

Either way you get bg-taqwim-primary, text-taqwim-foreground, rounded-taqwim-cell, text-taqwim-lg and so on. The values are var() references, so the utilities restyle themselves when data-taqwim-theme changes.

The headless packages ship no CSS. If you want to write every rule yourself, depend on @taqwim/vue (or the React, Svelte, Solid, Angular equivalent) and style the data attributes directly.