Skip to content

Repository files navigation

@tomasnikl/theme

Design tokens and a tiny light/dark theme runtime powering tomasnikl.cz and my lab projects.

Install

npm i @tomasnikl/theme

Usage

CSS — one import brings fonts, colors, typography, spacing, motion and dark-mode overrides:

@import "@tomasnikl/theme/tokens.css";

Or cherry-pick: @import "@tomasnikl/theme/tokens/colors.css";

JS — theme switching with localStorage persistence:

import { getTheme, setTheme, toggleTheme, subscribeTheme } from "@tomasnikl/theme";

Dark mode contract

setTheme("dark") sets data-theme="dark" on <html>; token overrides in tokens/dark.css key off :root[data-theme="dark"]. State persists under the tn-theme localStorage key.

Tokens

GroupFileExamples
Colorstokens/colors.css--accent, --surface-card, --ink-700, --text-body
Dark modetokens/dark.css--paper-0, --ink-900, --btn-primary-bg, --selection-bg
Typographytokens/typography.css--font-display, --text-h1, --weight-bold, --leading-normal
Spacingtokens/spacing.css--space-4, --radius-lg, --shadow-card, --container
Motiontokens/motion.css--ease-out, --dur-base, --reveal-rise
Fontstokens/fonts.cssloads Figtree and IBM Plex Mono via @import; no custom properties

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages