@nyxwire/tailwind 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +195 -2
- package/dist/docs/foundations/accessibility.md +71 -0
- package/dist/docs/foundations/color-roles.md +114 -0
- package/dist/docs/foundations/effects-motion.md +150 -0
- package/dist/docs/foundations/flavors.md +156 -0
- package/dist/docs/foundations/icons.md +45 -0
- package/dist/docs/foundations/palette.md +180 -0
- package/dist/docs/foundations/spacing-elevation.md +168 -0
- package/dist/docs/foundations/typography.md +80 -0
- package/dist/docs/index.md +55 -0
- package/dist/docs/manifest.json +71 -0
- package/dist/docs/merging.md +109 -0
- package/dist/docs/setup.md +85 -0
- package/dist/docs/theme-reference.md +225 -0
- package/dist/docs/utilities.md +225 -0
- package/dist/merge.d.ts +9 -0
- package/dist/merge.js +113 -0
- package/index.css +4 -0
- package/package.json +63 -3
- package/theme.css +350 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @nyxwire/tailwind 0.1.0
|
|
2
|
+
|
|
3
|
+
Nyxwire's Tailwind CSS v4 theme: palette and role colors, fonts, motif utilities and class merging.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
1. Install Tailwind 4 with its Vite plugin (or CLI) and the theme.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add -D tailwindcss @tailwindcss/vite
|
|
11
|
+
pnpm add @nyxwire/tailwind
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Import the theme after Tailwind in your stylesheet.
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
@import 'tailwindcss';
|
|
18
|
+
@import '@nyxwire/tailwind';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3. Use semantic utilities. They reference CSS variables, so flavors switch at runtime.
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<html data-flavor="nocturne" data-theme="dark">
|
|
25
|
+
<body class="bg-canvas text-fg font-sans">
|
|
26
|
+
<button class="bg-primary text-on-primary rounded-md glow-sm">Connect</button>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
See [Tailwind setup](setup.md) for the theme-only entry and for opting out of Tailwind's default colors.
|
|
32
|
+
|
|
33
|
+
## Conventions
|
|
34
|
+
|
|
35
|
+
- Import `tailwindcss`, then `@nyxwire/tailwind`. The theme maps Tailwind keys to Nyxwire variables, so flavors switch at runtime without rebuilding.
|
|
36
|
+
- Prefer semantic keys (`bg-canvas`, `text-fg`, `bg-primary`, `text-on-primary`, `border-line`) over raw palette keys (`nw-indigo`).
|
|
37
|
+
- Motif utilities: `cut`, `wire`, `glow-*`, `text-glow`, `glass`, `scanlines`, `grid-bg`. See [utilities.md](utilities.md).
|
|
38
|
+
- Merge classes with `cn()` from `@nyxwire/tailwind/merge`: it knows the theme's custom utilities. See [merging.md](merging.md).
|
|
39
|
+
|
|
40
|
+
## Files
|
|
41
|
+
|
|
42
|
+
Every file below documents @nyxwire/tailwind 0.1.0. Read the ones you need before writing code.
|
|
43
|
+
|
|
44
|
+
- [foundations/accessibility.md](foundations/accessibility.md): The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks.
|
|
45
|
+
- [foundations/color-roles.md](foundations/color-roles.md): Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette.
|
|
46
|
+
- [foundations/effects-motion.md](foundations/effects-motion.md): Cut corners, the wire edge, neon glow, scanlines, the circuit grid, glitch, glass, and motion tokens that respect reduced motion.
|
|
47
|
+
- [foundations/flavors.md](foundations/flavors.md): Pick a flavor with data attributes, nest scopes, swap the accent, and persist the visitor's choice without a flash.
|
|
48
|
+
- [foundations/icons.md](foundations/icons.md): Lucide icons through @lucide/vue, sized by the component around them and hidden from assistive technology unless they carry meaning.
|
|
49
|
+
- [foundations/palette.md](foundations/palette.md): Every Nyxwire color in all four flavors, generated from @nyxwire/palette with hex, RGB, OKLCH and contrast against the flavor's base.
|
|
50
|
+
- [foundations/spacing-elevation.md](foundations/spacing-elevation.md): The 0.25rem spacing grid, radius and cut scale, control heights, surface ramp, shadows and z-index layers.
|
|
51
|
+
- [foundations/typography.md](foundations/typography.md): Three bundled variable fonts, the type scale, heading roles and the typography classes.
|
|
52
|
+
- [merging.md](merging.md): cn() and the tailwind-merge configuration that knows the Nyxwire utilities, and tailwind-variants recipes built with createTV.
|
|
53
|
+
- [setup.md](setup.md): Add the Nyxwire theme to Tailwind CSS 4, with or without fonts and base styles, in a Vite app or a Starlight site.
|
|
54
|
+
- [theme-reference.md](theme-reference.md): Every color key, font, type step, spacing unit, radius, shadow, easing, animation and variant that @nyxwire/tailwind adds to Tailwind CSS 4.
|
|
55
|
+
- [utilities.md](utilities.md): Cut corners, wire edges, glow, text glow, the wire gradient, glass, scanlines, the circuit grid, glitch, animations, and the flavor variants of @nyxwire/tailwind, with live examples.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nyxwire/tailwind",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"files": [
|
|
5
|
+
{
|
|
6
|
+
"path": "foundations/accessibility.md",
|
|
7
|
+
"title": "Accessibility",
|
|
8
|
+
"description": "The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"path": "foundations/color-roles.md",
|
|
12
|
+
"title": "Color roles",
|
|
13
|
+
"description": "Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "foundations/effects-motion.md",
|
|
17
|
+
"title": "Effects & motion",
|
|
18
|
+
"description": "Cut corners, the wire edge, neon glow, scanlines, the circuit grid, glitch, glass, and motion tokens that respect reduced motion."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "foundations/flavors.md",
|
|
22
|
+
"title": "Flavors & theming",
|
|
23
|
+
"description": "Pick a flavor with data attributes, nest scopes, swap the accent, and persist the visitor's choice without a flash."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "foundations/icons.md",
|
|
27
|
+
"title": "Icons",
|
|
28
|
+
"description": "Lucide icons through @lucide/vue, sized by the component around them and hidden from assistive technology unless they carry meaning."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"path": "foundations/palette.md",
|
|
32
|
+
"title": "Palette",
|
|
33
|
+
"description": "Every Nyxwire color in all four flavors, generated from @nyxwire/palette with hex, RGB, OKLCH and contrast against the flavor's base."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "foundations/spacing-elevation.md",
|
|
37
|
+
"title": "Spacing & elevation",
|
|
38
|
+
"description": "The 0.25rem spacing grid, radius and cut scale, control heights, surface ramp, shadows and z-index layers."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"path": "foundations/typography.md",
|
|
42
|
+
"title": "Typography",
|
|
43
|
+
"description": "Three bundled variable fonts, the type scale, heading roles and the typography classes."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"path": "index.md",
|
|
47
|
+
"title": "@nyxwire/tailwind 0.1.0",
|
|
48
|
+
"description": "Setup, conventions and the list of every doc file."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "merging.md",
|
|
52
|
+
"title": "Class merging",
|
|
53
|
+
"description": "cn() and the tailwind-merge configuration that knows the Nyxwire utilities, and tailwind-variants recipes built with createTV."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"path": "setup.md",
|
|
57
|
+
"title": "Tailwind setup",
|
|
58
|
+
"description": "Add the Nyxwire theme to Tailwind CSS 4, with or without fonts and base styles, in a Vite app or a Starlight site."
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"path": "theme-reference.md",
|
|
62
|
+
"title": "Theme reference",
|
|
63
|
+
"description": "Every color key, font, type step, spacing unit, radius, shadow, easing, animation and variant that @nyxwire/tailwind adds to Tailwind CSS 4."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "utilities.md",
|
|
67
|
+
"title": "Utilities & variants",
|
|
68
|
+
"description": "Cut corners, wire edges, glow, text glow, the wire gradient, glass, scanlines, the circuit grid, glitch, animations, and the flavor variants of @nyxwire/tailwind, with live examples."
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Class merging
|
|
2
|
+
|
|
3
|
+
> cn() and the tailwind-merge configuration that knows the Nyxwire utilities, and tailwind-variants recipes built with createTV.
|
|
4
|
+
|
|
5
|
+
Components that accept a `class` prop need to merge it with their own classes so the caller wins: `p-4` passed in should replace the component's `p-2`, not sit next to it. [tailwind-merge](https://github.com/dcastil/tailwind-merge) does that for Tailwind's built-in utilities. `@nyxwire/tailwind/merge` extends it with the Nyxwire utilities.
|
|
6
|
+
|
|
7
|
+
## cn()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { cn } from '@nyxwire/tailwind/merge'
|
|
11
|
+
|
|
12
|
+
cn('rounded-md bg-panel p-2', props.class)
|
|
13
|
+
cn('glow-md glow-flux', isAlarm && 'glow-danger')
|
|
14
|
+
cn('bg-canvas', { 'bg-panel': raised }, [false, 'p-4'])
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`cn(...inputs)` accepts strings, numbers, bigints, `null`, `undefined`, booleans, nested readonly arrays and objects whose truthy keys are added. Falsy values are dropped, and it needs no `clsx`. When two classes set the same thing, the later one wins. Every result below was computed by the shipped `cn` when this page was built:
|
|
18
|
+
|
|
19
|
+
| Call | Result |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `cn('glow-sm glow-flux', 'glow-lg')` | `'glow-flux glow-lg'` |
|
|
22
|
+
| `cn('shadow-md', 'glow-sm')` | `'glow-sm'` |
|
|
23
|
+
| `cn('text-glow text-glow-nw-indigo', 'text-glow-matrix')` | `'text-glow text-glow-matrix'` |
|
|
24
|
+
| `cn('text-sm text-fg', 'text-fg-muted')` | `'text-sm text-fg-muted'` |
|
|
25
|
+
| `cn('bg-canvas px-4', 'bg-panel')` | `'px-4 bg-panel'` |
|
|
26
|
+
| `cn('bg-panel backdrop-blur-sm', 'glass')` | `'glass'` |
|
|
27
|
+
| `cn('glass', 'bg-panel')` | `'glass bg-panel'` |
|
|
28
|
+
| `cn('grid-bg', 'bg-wire')` | `'bg-wire'` |
|
|
29
|
+
| `cn('rounded-lg border bg-panel', 'cut')` | `'cut'` |
|
|
30
|
+
| `cn('border-line', 'wire')` | `'wire'` |
|
|
31
|
+
| `cn('text-fg bg-clip-padding', 'text-wire')` | `'text-wire'` |
|
|
32
|
+
| `cn('rounded-md shadow-sm', 'rounded-xl shadow-lg')` | `'rounded-xl shadow-lg'` |
|
|
33
|
+
| `cn('font-sans', 'font-display')` | `'font-display'` |
|
|
34
|
+
| `cn('animate-fade-in', 'animate-glow-pulse')` | `'animate-glow-pulse'` |
|
|
35
|
+
| `cn('ease-standard', 'ease-back')` | `'ease-back'` |
|
|
36
|
+
|
|
37
|
+
What the configuration teaches tailwind-merge:
|
|
38
|
+
|
|
39
|
+
- **Glow sizes** (`glow-sm`, `glow-md`, `glow-lg`, `wire-glow`) share the box-shadow group, so they replace each other and any `shadow-*`.
|
|
40
|
+
- **Glow colors** have a group of their own, shared by `glow-*` and `text-glow-*`: the last color wins, and a size never removes a color.
|
|
41
|
+
- **`text-glow`** belongs to the text-shadow group.
|
|
42
|
+
- **`bg-wire`** belongs to the background-image group, so it replaces another gradient and can sit next to a background color.
|
|
43
|
+
- **`grid-bg`** paints its own background image and size, so it conflicts with `bg-wire`, `cut`, `wire` and `text-wire`.
|
|
44
|
+
- **`cut`** replaces an earlier radius, border width or background color: its shape and fill come from `--nw-cut` and `--nw-fill`.
|
|
45
|
+
- **`wire`** replaces an earlier border color.
|
|
46
|
+
- **`glass`** replaces an earlier `bg-*` color or `backdrop-blur-*`. A color written after it still applies.
|
|
47
|
+
- **`text-wire`** replaces an earlier text color, background image or background clip.
|
|
48
|
+
- **`scanlines`** and **`glitch`** have groups of their own and never remove anything.
|
|
49
|
+
- **The type scale, radius, easings and animations** extend Tailwind's scales: `text-2xs`, `rounded-xs`, `ease-back` and `animate-glow-pulse` merge like their built-in neighbors.
|
|
50
|
+
|
|
51
|
+
A later override of one part of a composite, such as `bg-panel` after `glass`, keeps the other parts intact.
|
|
52
|
+
|
|
53
|
+
## twMergeConfig
|
|
54
|
+
|
|
55
|
+
To use the configuration with your own tailwind-merge instance, pass it to `extendTailwindMerge`:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { extendTailwindMerge } from 'tailwind-merge'
|
|
59
|
+
import { twMergeConfig } from '@nyxwire/tailwind/merge'
|
|
60
|
+
|
|
61
|
+
export const merge = extendTailwindMerge(twMergeConfig)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`twMergeConfig` is typed as `TwMergeConfig`. The module also exports the `ClassValue`, `ClassDictionary` and `NyxwireClassGroupIds` types.
|
|
65
|
+
|
|
66
|
+
## Recipes with tailwind-variants
|
|
67
|
+
|
|
68
|
+
[tailwind-variants](https://www.tailwind-variants.org/) builds class lists from variants. Create its `tv` with `createTV` from the `tailwind-variants/config` entry point, so every recipe merges with the Nyxwire configuration:
|
|
69
|
+
|
|
70
|
+
```ts title="src/lib/tv.ts"
|
|
71
|
+
import { createTV } from 'tailwind-variants/config'
|
|
72
|
+
import { twMergeConfig } from '@nyxwire/tailwind/merge'
|
|
73
|
+
|
|
74
|
+
export const tv = createTV({ twMergeConfig })
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> **Caution**
|
|
78
|
+
>
|
|
79
|
+
> Use the `tailwind-variants/config` entry. The package's default entry throws when it is given
|
|
80
|
+
> `twMergeConfig`.
|
|
81
|
+
|
|
82
|
+
```ts title="src/lib/signal.ts"
|
|
83
|
+
import { tv } from './tv'
|
|
84
|
+
|
|
85
|
+
export const signal = tv({
|
|
86
|
+
base: 'inline-flex items-center gap-1 rounded-md px-2 py-0.5 font-mono text-xs',
|
|
87
|
+
variants: {
|
|
88
|
+
intent: {
|
|
89
|
+
primary: 'bg-primary-soft text-primary',
|
|
90
|
+
danger: 'bg-danger-soft text-danger',
|
|
91
|
+
},
|
|
92
|
+
glowing: { true: 'glow-sm' },
|
|
93
|
+
},
|
|
94
|
+
compoundVariants: [{ intent: 'danger', glowing: true, class: 'glow-danger' }],
|
|
95
|
+
defaultVariants: { intent: 'primary' },
|
|
96
|
+
})
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The same recipe, rendered when this page was built. In the last row the caller's `rounded-full` replaces the base `rounded-md`:
|
|
100
|
+
|
|
101
|
+
_Live example: [Class merging](https://nyxwire.dissidence.ovh/tailwind/merging/)._
|
|
102
|
+
|
|
103
|
+
## In Vue
|
|
104
|
+
|
|
105
|
+
`@nyxwire/vue` exports the same two helpers, already configured: `cn` is the function above and `tv` is created with `createTV({ twMergeConfig })`. Its components merge their `class` prop with them, so overrides behave the same everywhere.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { cn, tv } from '@nyxwire/vue'
|
|
109
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Tailwind setup
|
|
2
|
+
|
|
3
|
+
> Add the Nyxwire theme to Tailwind CSS 4, with or without fonts and base styles, in a Vite app or a Starlight site.
|
|
4
|
+
|
|
5
|
+
`@nyxwire/tailwind` is a CSS-first theme for Tailwind CSS 4.3: an `@theme inline` block, custom variants and custom utilities. There is no JavaScript config. A typed merge helper ships alongside ([Class merging](merging.md)).
|
|
6
|
+
|
|
7
|
+
1. Install Tailwind 4 with its Vite plugin (or the CLI) and the theme.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add -D tailwindcss @tailwindcss/vite
|
|
11
|
+
pnpm add @nyxwire/tailwind @nyxwire/css
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. Register the Vite plugin.
|
|
15
|
+
|
|
16
|
+
```ts title="vite.config.ts"
|
|
17
|
+
import { defineConfig } from 'vite'
|
|
18
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
19
|
+
|
|
20
|
+
export default defineConfig({ plugins: [tailwindcss()] })
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. Import the theme after Tailwind.
|
|
24
|
+
|
|
25
|
+
```css title="src/style.css"
|
|
26
|
+
@import 'tailwindcss';
|
|
27
|
+
@import '@nyxwire/tailwind';
|
|
28
|
+
@import '@nyxwire/vue/tailwind.css'; /* only with @nyxwire/vue */
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
4. Set the flavor on the document (or let a flavor runtime do it) and use the utilities.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<html data-flavor="nocturne" data-accent="indigo">
|
|
35
|
+
<body class="bg-canvas font-sans text-fg">
|
|
36
|
+
<button class="rounded-md bg-primary px-4 py-2 text-on-primary glow-sm">Connect</button>
|
|
37
|
+
</body>
|
|
38
|
+
</html>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## What each line does
|
|
42
|
+
|
|
43
|
+
| Import | Brings |
|
|
44
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `@nyxwire/tailwind` | `@nyxwire/css` tokens, the locally bundled fonts, the base styles (with the `nw-*` keyframes), then the theme |
|
|
46
|
+
| `@nyxwire/tailwind/theme.css` | The theme only: colors, fonts, type scale, spacing, radius, shadows, easings, animations, motif utilities, variants |
|
|
47
|
+
| `@nyxwire/vue/tailwind.css` | An `@source` for the Vue package's `dist`, so Tailwind generates the classes its components use |
|
|
48
|
+
|
|
49
|
+
The entry does not import the `nw-*` component classes. Use `theme.css` when another stylesheet already loads `@nyxwire/css` (or at least its tokens, fonts and base): the `animate-*` utilities run the `nw-*` keyframes defined in `@nyxwire/css/base.css`, so the theme-only form expects that base to be present.
|
|
50
|
+
|
|
51
|
+
## Runtime theming
|
|
52
|
+
|
|
53
|
+
Every mapping uses `@theme inline`, so generated CSS points at the `--nw-*` variables directly. Switching `data-flavor` or `data-accent` restyles every utility without a rebuild, nested scopes included, and opacity modifiers mix the variable: `bg-primary/20` compiles to `color-mix(in oklab, var(--nw-primary) 20%, transparent)`.
|
|
54
|
+
|
|
55
|
+
In your own CSS, write `var(--nw-primary)` rather than `var(--color-primary)` when a value must follow a nested flavor scope.
|
|
56
|
+
|
|
57
|
+
> **Note**
|
|
58
|
+
>
|
|
59
|
+
> Raw palette colors always carry the `nw-` prefix (`bg-nw-base`, `text-nw-flux`). An unprefixed
|
|
60
|
+
> `base` color would make Tailwind read `text-base` as a color instead of the font size. Semantic
|
|
61
|
+
> keys (`bg-canvas`, `text-fg`) have no prefix because none collides with a Tailwind name.
|
|
62
|
+
|
|
63
|
+
## Opt out of Tailwind's default colors
|
|
64
|
+
|
|
65
|
+
Tailwind's own palette stays available next to Nyxwire's. To remove it, reset the color namespace before the theme, so the Nyxwire mappings are declared after the reset:
|
|
66
|
+
|
|
67
|
+
```css title="src/style.css"
|
|
68
|
+
@import 'tailwindcss';
|
|
69
|
+
@import './palette-reset.css';
|
|
70
|
+
@import '@nyxwire/tailwind';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```css title="src/palette-reset.css"
|
|
74
|
+
@theme {
|
|
75
|
+
--color-*: initial;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Font files with the Tailwind CLI
|
|
80
|
+
|
|
81
|
+
Vite and other bundlers rewrite the relative font URLs in `@nyxwire/css/fonts.css`. The standalone Tailwind CLI leaves `url('./fonts/…')` as written, so copy the font directory next to the stylesheet it emits. The package's own demo does this with `demo/copy-fonts.ts`, which resolves the files through the `@nyxwire/css/fonts.css` export.
|
|
82
|
+
|
|
83
|
+
## Starlight and other layered setups
|
|
84
|
+
|
|
85
|
+
Starlight ships its own reset, so a Starlight site imports Tailwind's theme and utilities into explicit layers instead of `tailwindcss`, and uses `theme.css`. The full stylesheet is on [Starlight setup](https://nyxwire.dissidence.ovh/starlight/setup/#tailwind-in-starlight).
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Theme reference
|
|
2
|
+
|
|
3
|
+
> Every color key, font, type step, spacing unit, radius, shadow, easing, animation and variant that @nyxwire/tailwind adds to Tailwind CSS 4.
|
|
4
|
+
|
|
5
|
+
`@nyxwire/tailwind` maps its theme with `@theme inline`, so every utility below compiles to a `var(--nw-*)` reference. A flavor or accent change restyles the page at runtime; nothing is recompiled. Tailwind's breakpoints, its larger radius and shadow steps and its other defaults stay as they are.
|
|
6
|
+
|
|
7
|
+
## Colors
|
|
8
|
+
|
|
9
|
+
Two families of color keys. **Semantic** keys have no prefix and follow the nearest flavor scope; use them for components. **Raw** palette keys always carry the `nw-` prefix; use them when you mean one specific color. The chips resolve in the flavor you picked in the header.
|
|
10
|
+
|
|
11
|
+
| Key | Value |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `nw-crust` | `var(--nw-crust)` |
|
|
14
|
+
| `nw-mantle` | `var(--nw-mantle)` |
|
|
15
|
+
| `nw-base` | `var(--nw-base)` |
|
|
16
|
+
| `nw-surface0` | `var(--nw-surface0)` |
|
|
17
|
+
| `nw-surface1` | `var(--nw-surface1)` |
|
|
18
|
+
| `nw-surface2` | `var(--nw-surface2)` |
|
|
19
|
+
| `nw-overlay0` | `var(--nw-overlay0)` |
|
|
20
|
+
| `nw-overlay1` | `var(--nw-overlay1)` |
|
|
21
|
+
| `nw-overlay2` | `var(--nw-overlay2)` |
|
|
22
|
+
| `nw-subtext0` | `var(--nw-subtext0)` |
|
|
23
|
+
| `nw-subtext1` | `var(--nw-subtext1)` |
|
|
24
|
+
| `nw-text` | `var(--nw-text)` |
|
|
25
|
+
| `nw-indigo` | `var(--nw-indigo)` |
|
|
26
|
+
| `nw-iris` | `var(--nw-iris)` |
|
|
27
|
+
| `nw-flux` | `var(--nw-flux)` |
|
|
28
|
+
| `nw-synth` | `var(--nw-synth)` |
|
|
29
|
+
| `nw-alarm` | `var(--nw-alarm)` |
|
|
30
|
+
| `nw-flare` | `var(--nw-flare)` |
|
|
31
|
+
| `nw-volt` | `var(--nw-volt)` |
|
|
32
|
+
| `nw-matrix` | `var(--nw-matrix)` |
|
|
33
|
+
| `nw-circuit` | `var(--nw-circuit)` |
|
|
34
|
+
| `nw-ice` | `var(--nw-ice)` |
|
|
35
|
+
| `nw-arc` | `var(--nw-arc)` |
|
|
36
|
+
| `nw-steel` | `var(--nw-steel)` |
|
|
37
|
+
| `canvas` | `var(--nw-canvas)` |
|
|
38
|
+
| `canvas-subtle` | `var(--nw-canvas-subtle)` |
|
|
39
|
+
| `canvas-sunken` | `var(--nw-canvas-sunken)` |
|
|
40
|
+
| `panel` | `var(--nw-panel)` |
|
|
41
|
+
| `panel-hover` | `var(--nw-panel-hover)` |
|
|
42
|
+
| `panel-active` | `var(--nw-panel-active)` |
|
|
43
|
+
| `fg` | `var(--nw-fg)` |
|
|
44
|
+
| `fg-muted` | `var(--nw-fg-muted)` |
|
|
45
|
+
| `fg-subtle` | `var(--nw-fg-subtle)` |
|
|
46
|
+
| `fg-faint` | `var(--nw-fg-faint)` |
|
|
47
|
+
| `fg-disabled` | `var(--nw-fg-disabled)` |
|
|
48
|
+
| `line` | `var(--nw-line)` |
|
|
49
|
+
| `line-strong` | `var(--nw-line-strong)` |
|
|
50
|
+
| `line-bright` | `var(--nw-line-bright)` |
|
|
51
|
+
| `primary` | `var(--nw-primary)` |
|
|
52
|
+
| `on-primary` | `var(--nw-on-primary)` |
|
|
53
|
+
| `primary-soft` | `var(--nw-primary-soft)` |
|
|
54
|
+
| `secondary` | `var(--nw-secondary)` |
|
|
55
|
+
| `on-secondary` | `var(--nw-on-secondary)` |
|
|
56
|
+
| `secondary-soft` | `var(--nw-secondary-soft)` |
|
|
57
|
+
| `tertiary` | `var(--nw-tertiary)` |
|
|
58
|
+
| `on-tertiary` | `var(--nw-on-tertiary)` |
|
|
59
|
+
| `tertiary-soft` | `var(--nw-tertiary-soft)` |
|
|
60
|
+
| `info` | `var(--nw-info)` |
|
|
61
|
+
| `on-info` | `var(--nw-on-info)` |
|
|
62
|
+
| `info-soft` | `var(--nw-info-soft)` |
|
|
63
|
+
| `success` | `var(--nw-success)` |
|
|
64
|
+
| `on-success` | `var(--nw-on-success)` |
|
|
65
|
+
| `success-soft` | `var(--nw-success-soft)` |
|
|
66
|
+
| `warning` | `var(--nw-warning)` |
|
|
67
|
+
| `on-warning` | `var(--nw-on-warning)` |
|
|
68
|
+
| `warning-soft` | `var(--nw-warning-soft)` |
|
|
69
|
+
| `danger` | `var(--nw-danger)` |
|
|
70
|
+
| `on-danger` | `var(--nw-on-danger)` |
|
|
71
|
+
| `danger-soft` | `var(--nw-danger-soft)` |
|
|
72
|
+
| `ring` | `var(--nw-ring)` |
|
|
73
|
+
| `link` | `var(--nw-link)` |
|
|
74
|
+
| `selection` | `var(--nw-selection)` |
|
|
75
|
+
| `shadow-ink` | `var(--nw-shadow-ink)` |
|
|
76
|
+
| `backdrop` | `var(--nw-backdrop)` |
|
|
77
|
+
| `glass` | `var(--nw-glass)` |
|
|
78
|
+
|
|
79
|
+
Every key works with all of Tailwind's color utilities: `bg-*`, `text-*`, `border-*`, `ring-*`, `outline-*`, `fill-*`, `stroke-*`, `decoration-*`, `caret-*` and the rest.
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<div class="rounded-lg border border-line bg-panel text-fg">
|
|
83
|
+
<p class="text-fg-muted">Relay 07</p>
|
|
84
|
+
<span class="text-nw-matrix">online</span>
|
|
85
|
+
<span class="bg-warning-soft text-warning">degraded</span>
|
|
86
|
+
</div>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Every intent has its pair and its soft tint: `bg-danger text-on-danger` for a solid fill, `bg-danger-soft text-danger` for a quiet one. `on-*` is `crust` on the dark flavors and `base` on Lumen. Opacity modifiers mix the variable, so they follow the flavor too: `bg-primary/20` compiles to `color-mix(in oklab, var(--nw-primary) 20%, transparent)`.
|
|
90
|
+
|
|
91
|
+
> **Note**
|
|
92
|
+
>
|
|
93
|
+
> `text-base` stays the 1rem font size. The raw `base` color is `nw-base` (`bg-nw-base`), because an
|
|
94
|
+
> unprefixed `base` color would make Tailwind read `text-base` as a color.
|
|
95
|
+
|
|
96
|
+
## Fonts
|
|
97
|
+
|
|
98
|
+
| Utility | Token | Family |
|
|
99
|
+
| -------------- | ------------------- | ---------------------- |
|
|
100
|
+
| `font-display` | `--nw-font-display` | Space Grotesk Variable |
|
|
101
|
+
| `font-sans` | `--nw-font-sans` | Inter Variable |
|
|
102
|
+
| `font-mono` | `--nw-font-mono` | Martian Mono Variable |
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<p class="m-0 font-display text-2xl font-semibold tracking-tight">
|
|
106
|
+
font-display: The grid wakes at midnight
|
|
107
|
+
</p>
|
|
108
|
+
<p class="m-0 font-sans text-base">font-sans: Body copy, labels and controls.</p>
|
|
109
|
+
<p class="m-0 font-mono text-sm text-fg-muted">font-mono: relay 07 · latency 18ms · uplink ok</p>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`@import '@nyxwire/tailwind'` also loads the bundled font files; `@nyxwire/tailwind/theme.css` maps the families without loading them.
|
|
113
|
+
|
|
114
|
+
## Type scale
|
|
115
|
+
|
|
116
|
+
`text-2xs` through `text-7xl` map to `--nw-text-2xs` through `--nw-text-7xl`. From `text-xl` up, each step also sets the Nyxwire leading (`snug` for `xl` and `2xl`, `tight` above); smaller steps inherit the leading of their context. `leading-{none,tight,snug,normal,relaxed}` and `tracking-{tighter,tight,normal,wide,wider,widest}` map to the matching `--nw-leading-*` and `--nw-tracking-*` tokens.
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<p class="m-0 font-mono text-2xs text-fg-muted">text-2xs · status strips</p>
|
|
120
|
+
<p class="m-0 text-sm">text-sm · controls and table cells</p>
|
|
121
|
+
<p class="m-0 text-base">text-base · body copy</p>
|
|
122
|
+
<p class="m-0 font-display text-2xl font-semibold">text-2xl · section title</p>
|
|
123
|
+
<p class="m-0 font-display text-4xl font-bold tracking-tight">text-4xl · hero</p>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Spacing
|
|
127
|
+
|
|
128
|
+
Tailwind's spacing multiplier is `var(--nw-space-1)` (0.25rem), so `p-4`, `gap-1.5`, `mt-8` and every other spacing utility land on the Nyxwire 4px grid. Tokens without a Tailwind scale of the same name stay reachable with arbitrary values: `h-(--nw-control-md)`, `z-(--nw-z-modal)`, `[--nw-cut:1rem]`.
|
|
129
|
+
|
|
130
|
+
## Radius
|
|
131
|
+
|
|
132
|
+
| Utility | Token | Value |
|
|
133
|
+
| -------------- | ------------------ | ------ |
|
|
134
|
+
| `rounded-xs` | `--nw-radius-xs` | 2px |
|
|
135
|
+
| `rounded-sm` | `--nw-radius-sm` | 4px |
|
|
136
|
+
| `rounded-md` | `--nw-radius-md` | 8px |
|
|
137
|
+
| `rounded-lg` | `--nw-radius-lg` | 12px |
|
|
138
|
+
| `rounded-xl` | `--nw-radius-xl` | 16px |
|
|
139
|
+
| `rounded-2xl` | `--nw-radius-2xl` | 24px |
|
|
140
|
+
| `rounded-full` | `--nw-radius-full` | 9999px |
|
|
141
|
+
|
|
142
|
+
Directional forms (`rounded-t-lg`, `rounded-s-md`, …) use the same values.
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<div class="rounded-xs border border-line bg-panel p-4 font-mono text-sm">rounded-xs</div>
|
|
146
|
+
<div class="rounded-sm border border-line bg-panel p-4 font-mono text-sm">rounded-sm</div>
|
|
147
|
+
<div class="rounded-md border border-line bg-panel p-4 font-mono text-sm">rounded-md</div>
|
|
148
|
+
<div class="rounded-lg border border-line bg-panel p-4 font-mono text-sm">rounded-lg</div>
|
|
149
|
+
<div class="rounded-xl border border-line bg-panel p-4 font-mono text-sm">rounded-xl</div>
|
|
150
|
+
<div class="rounded-2xl border border-line bg-panel p-4 font-mono text-sm">rounded-2xl</div>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Shadows
|
|
154
|
+
|
|
155
|
+
| Utility | Token | Use |
|
|
156
|
+
| ------------------ | ---------------- | -------------------------------- |
|
|
157
|
+
| `shadow-sm` | `--nw-shadow-sm` | Cards |
|
|
158
|
+
| `shadow-md` | `--nw-shadow-md` | Toasts, HUD panels |
|
|
159
|
+
| `shadow-lg` | `--nw-shadow-lg` | Menus, popovers, dialogs |
|
|
160
|
+
| `shadow-glow-sm` | `--nw-glow-sm` | The neon glow as a plain shadow |
|
|
161
|
+
| `shadow-glow-md` | `--nw-glow-md` | |
|
|
162
|
+
| `shadow-glow-lg` | `--nw-glow-lg` | |
|
|
163
|
+
| `shadow-glow-wire` | `--nw-glow-wire` | Primary-to-secondary bloom |
|
|
164
|
+
| `text-shadow-glow` | `--nw-glow-text` | Text glow as a plain text shadow |
|
|
165
|
+
|
|
166
|
+
```html
|
|
167
|
+
<div class="rounded-lg border border-line bg-panel p-4 font-mono text-sm shadow-sm">
|
|
168
|
+
shadow-sm
|
|
169
|
+
</div>
|
|
170
|
+
<div class="rounded-lg border border-line bg-panel p-4 font-mono text-sm shadow-md">
|
|
171
|
+
shadow-md
|
|
172
|
+
</div>
|
|
173
|
+
<div class="rounded-lg border border-line bg-panel p-4 font-mono text-sm shadow-lg">
|
|
174
|
+
shadow-lg
|
|
175
|
+
</div>
|
|
176
|
+
<div class="rounded-lg border border-primary/60 bg-panel p-4 font-mono text-sm shadow-glow-md">
|
|
177
|
+
shadow-glow-md
|
|
178
|
+
</div>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Shadows are drawn in `--nw-shadow-ink` and are stronger on the dark flavors than on Lumen. The `glow-*` motif utilities, which also handle cut corners, are on [Utilities & variants](utilities.md#glow).
|
|
182
|
+
|
|
183
|
+
## Blur
|
|
184
|
+
|
|
185
|
+
`blur-sm`, `blur-md` and `blur-lg` (and their `backdrop-blur-*` forms) map to `--nw-blur-sm` (4px), `--nw-blur-md` (12px) and `--nw-blur-lg` (24px). The [`glass`](utilities.md#glass) utility uses `--nw-blur-md`.
|
|
186
|
+
|
|
187
|
+
## Easing
|
|
188
|
+
|
|
189
|
+
| Utility | Token | Curve | Use |
|
|
190
|
+
| --------------- | -------------------- | ----------------------------------- | ----------------------- |
|
|
191
|
+
| `ease-standard` | `--nw-ease-standard` | `cubic-bezier(0.2, 0, 0, 1)` | Hover and state changes |
|
|
192
|
+
| `ease-out` | `--nw-ease-out` | `cubic-bezier(0.16, 1, 0.3, 1)` | Entrances |
|
|
193
|
+
| `ease-in` | `--nw-ease-in` | `cubic-bezier(0.7, 0, 0.84, 0)` | Exits |
|
|
194
|
+
| `ease-in-out` | `--nw-ease-in-out` | `cubic-bezier(0.65, 0, 0.35, 1)` | Moves across the screen |
|
|
195
|
+
| `ease-back` | `--nw-ease-back` | `cubic-bezier(0.34, 1.56, 0.64, 1)` | Small overshoot |
|
|
196
|
+
|
|
197
|
+
`ease-out`, `ease-in` and `ease-in-out` replace Tailwind's curves of the same name. A bare `transition` uses `--nw-duration-fast` (140ms) and `--nw-ease-standard`; pair the easings with Tailwind's `duration-*` utilities for anything else.
|
|
198
|
+
|
|
199
|
+
## Animations
|
|
200
|
+
|
|
201
|
+
Each utility runs a keyframe of the same name with an `nw-` prefix, defined in `@nyxwire/css/base.css`. Entrances and exits run once with the motion tokens; the decorative ones loop.
|
|
202
|
+
|
|
203
|
+
| Utility | Timing | Notes |
|
|
204
|
+
| ----------------------------------------------- | ----------------------- | ---------------------------------------------------- |
|
|
205
|
+
| `animate-fade-in`, `animate-zoom-in` | 220ms, `ease-out`, once | Entrances |
|
|
206
|
+
| `animate-fade-out`, `animate-zoom-out` | 140ms, `ease-in`, once | Exits |
|
|
207
|
+
| `animate-slide-in-from-{top,bottom,left,right}` | 220ms, `ease-out`, once | Moves `--nw-slide-distance` (0.5rem) while fading in |
|
|
208
|
+
| `animate-slide-out-to-{top,bottom,left,right}` | 140ms, `ease-in`, once | Moves `--nw-slide-distance` while fading out |
|
|
209
|
+
| `animate-glitch` | 480ms, stepped, once | One glitch burst |
|
|
210
|
+
| `animate-glow-pulse` | 2s loop | The glow breathes |
|
|
211
|
+
| `animate-pulse` | 2s loop | Opacity pulse |
|
|
212
|
+
| `animate-spin` | 1s linear loop | Spinners |
|
|
213
|
+
| `animate-shimmer` | 2s linear loop | Slides an oversized background image |
|
|
214
|
+
|
|
215
|
+
Under `prefers-reduced-motion: reduce`, the imported base collapses decorative animations, variant forms included, to one near-instant iteration. Live examples are on [Utilities & variants](utilities.md#animations).
|
|
216
|
+
|
|
217
|
+
## Variants
|
|
218
|
+
|
|
219
|
+
| Variant | Matches |
|
|
220
|
+
| -------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
221
|
+
| `abyss:`, `nocturne:`, `twilight:`, `lumen:` | the matching `[data-flavor]` on the element or an ancestor |
|
|
222
|
+
| `dark:` | `data-flavor` of `abyss`, `nocturne` or `twilight` on the element or an ancestor |
|
|
223
|
+
| `light:` | `data-flavor="lumen"` on the element or an ancestor |
|
|
224
|
+
|
|
225
|
+
`dark:` follows the `data-flavor` attribute, not `prefers-color-scheme`. See [Utilities & variants](utilities.md#variants) for how the variants behave in nested scopes.
|