@kystverket/styrbord-tokens 0.3.13 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,67 @@
1
- # styrbord-tokens
1
+ # styrbord-tokens
2
+
3
+ `@kystverket/styrbord-tokens` is the CSS design token package for Kystverket's design system, Styrbord. It provides color, typography, spacing, and other design tokens as CSS custom properties, plus a typed JavaScript module for use in TypeScript/Node.js projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @kystverket/styrbord-tokens
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### CSS (browser / SSR)
14
+
15
+ Import the stylesheet to get all tokens as CSS custom properties:
16
+
17
+ ```css
18
+ @import '@kystverket/styrbord-tokens';
19
+ ```
20
+
21
+ Or in JavaScript/TypeScript:
22
+
23
+ ```ts
24
+ import '@kystverket/styrbord-tokens';
25
+ ```
26
+
27
+ Tokens are then available as CSS variables:
28
+
29
+ ```css
30
+ .my-element {
31
+ background-color: var(--ds-color-primary-background-default);
32
+ color: var(--ds-color-primary-text-default);
33
+ border: 1px solid var(--ds-color-primary-border-default);
34
+ }
35
+ ```
36
+
37
+ ### TypeScript / JavaScript (hex values)
38
+
39
+ For contexts where CSS variables aren't available — Node.js tooling, chart libraries, image generation, etc. — import the `colors` module to get static hex values for both light and dark modes:
40
+
41
+ ```ts
42
+ import { colors } from '@kystverket/styrbord-tokens/colors';
43
+
44
+ colors.light.primary.baseDefault // "#000667"
45
+ colors.dark.primary.baseDefault // "#a7a9ca"
46
+ colors.light.accent.backgroundDefault // "#ffffff"
47
+ colors.light.hav.baseDefault // Kystverket brand palette
48
+ ```
49
+
50
+ #### Available color roles
51
+
52
+ | Role | Description |
53
+ |------|-------------|
54
+ | `primary` | Main brand color (navy) |
55
+ | `accent` | Accent color (coral/red) |
56
+ | `neutral` | Greys |
57
+ | `extra1` | Extra semantic role 1 |
58
+ | `extra2` | Extra semantic role 2 |
59
+ | `success` | Positive feedback |
60
+ | `danger` | Destructive / error |
61
+ | `warning` | Caution |
62
+ | `info` | Informational |
63
+ | `hav`, `stein`, `gress`, `sol`, `lyng`, `himmel`, `sand`, `fyr`, `dyphav`, `skog` | Kystverket brand palette |
64
+
65
+ Each role exposes 16 slots: `backgroundDefault`, `backgroundTinted`, `surfaceDefault`, `surfaceTinted`, `surfaceHover`, `surfaceActive`, `borderSubtle`, `borderDefault`, `borderStrong`, `textSubtle`, `textDefault`, `baseDefault`, `baseHover`, `baseActive`, `baseContrastSubtle`, `baseContrastDefault`.
66
+
67
+ > **Note:** Hex values are static snapshots. For runtime theme switching (light/dark), use the CSS custom properties instead.