@spiffdog/spiffy-colors
v3.0.1
Published
`npm install @spiffdog/spiffy-colors`
Downloads
476
Readme
Usage
npm install @spiffdog/spiffy-colors
This package exposes a single OKLab-based palette for both light and dark appearance using the CSS light-dark() function.
CSS
- Import
dist/index.css. It defines one:rootblock that:- Sets
color-scheme: light darkso the browser can resolvelight-dark()and form controls / scrollbars match the active scheme. - Declares palette variables such as
--gray1,--blue12, etc. Each value islight-dark(<light-oklab>, <dark-oklab>).
- Sets
If you do not import this stylesheet but still use the tokens (for example from the JS export in your own CSS-in-JS or shadow DOM), you must set an appropriate color-scheme on an ancestor (commonly :root / html)—for example light dark when following system light/dark, or light / dark when forcing one appearance—otherwise light-dark() may not resolve as intended. See MDN: light-dark() and color-scheme.
Javascript / Typescript
palette— oneThemeobject insrc/palette.ts; each leaf is a CSS color string usinglight-dark(...), suitable forcolor,background, and other properties in supporting browsers.
Typings are included (dist/types / emitted declarations alongside the build).
Documentation
OKLab scales and previews live on the documentation site:
