@nyxwire/astro 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Florian Maunier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,206 @@
1
- # Temporary Holding Version
1
+ # @nyxwire/astro
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Astro 7 integration and framework-free components for Nyxwire websites. Fonts, colors and
4
+ styles are bundled locally; nothing loads from a CDN.
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ pnpm add @nyxwire/astro @nyxwire/css
10
+ ```
11
+
12
+ ## Integration
13
+
14
+ ```js
15
+ // astro.config.mjs
16
+ import { defineConfig } from 'astro/config'
17
+ import nyxwire from '@nyxwire/astro'
18
+
19
+ export default defineConfig({
20
+ integrations: [nyxwire({ flavors: { dark: 'nocturne' }, accent: 'indigo' })],
21
+ })
22
+ ```
23
+
24
+ The integration inserts a synchronous, self-contained script into the `<head>` of every page
25
+ (`injectScript('head-inline')`), so the flavor is applied before first paint and before any island
26
+ hydrates. It imports the chosen stylesheet through Astro's `page-ssr` stage. Invalid values and
27
+ unknown option names throw `NyxwireOptionsError`, naming the option, the accepted values and
28
+ what was received.
29
+
30
+ | Option | Values | Default |
31
+ | --------------- | ------------------------------------------------------------------------------------------------------- | ---------- |
32
+ | `flavors.dark` | `abyss`, `nocturne`, `twilight` | `nocturne` |
33
+ | `flavors.light` | `lumen` | `lumen` |
34
+ | `defaultFlavor` | `auto`, `abyss`, `nocturne`, `twilight`, `lumen` | `auto` |
35
+ | `accent` | `indigo`, `iris`, `flux`, `synth`, `alarm`, `flare`, `volt`, `matrix`, `circuit`, `ice`, `arc`, `steel` | none |
36
+ | `persist` | `true`, `false` | `true` |
37
+ | `styles` | `'full'`, `'tokens'`, `false` | `'full'` |
38
+ | `css` | `true`, `false` | `true` |
39
+
40
+ - `flavors.dark` is the flavor Auto resolves to when the system prefers dark; `flavors.light` is
41
+ used when it prefers light.
42
+ - `defaultFlavor` is the preference used when nothing valid is stored. `auto` follows
43
+ `prefers-color-scheme`.
44
+ - `accent` sets `data-accent` on `<html>` and re-points `--nw-primary` (links, active states,
45
+ focus rings). Without it, the palette default (indigo) applies.
46
+ - `persist: false` keeps choices in memory only and ignores stored values.
47
+ - `styles: 'full'` imports `@nyxwire/css`. `'tokens'` imports `@nyxwire/css/tokens.css` and
48
+ `@nyxwire/css/fonts.css` only, leaving element and component styling to your app. `false`
49
+ imports no CSS. `css: false` is shorthand for `styles: false`.
50
+
51
+ ## Layout
52
+
53
+ ```astro
54
+ ---
55
+ import Layout from '@nyxwire/astro/components/Layout.astro'
56
+ import FlavorSelect from '@nyxwire/astro/components/FlavorSelect.astro'
57
+ ---
58
+
59
+ <Layout title="Settings" description="Choose your appearance." lang="en" class="settings">
60
+ <link slot="head" rel="icon" href="/favicon.svg" />
61
+ <main class="nw-container nw-stack">
62
+ <h1>Settings</h1>
63
+ <FlavorSelect label="Color flavor" />
64
+ </main>
65
+ </Layout>
66
+ ```
67
+
68
+ Layout renders a complete document for non-Starlight routes. It accepts `title` (default
69
+ `Nyxwire`), `description`, `lang` (default `en`), `flavor`, `accent` and `class` (on `<body>`).
70
+ The default slot holds the page, and the `head` slot holds extra metadata. It applies the
71
+ token-based page background, foreground, font and line height. It does not impose a content grid
72
+ or wrap your content in landmarks.
73
+
74
+ Without a `flavor` prop, the server HTML leaves the flavor unset, so the palette's
75
+ system-preference CSS works without JavaScript. Theme-color metadata then uses dark and light media
76
+ queries (the default dark flavor's base and Lumen's base). A `flavor` prop supplies the initial
77
+ server attributes (`data-flavor`, `data-theme`) and that flavor's base color. After load, the
78
+ runtime owns the root attributes and updates theme-color metadata to the resolved flavor. For an
79
+ intentional initial preference, also set `defaultFlavor` on the integration; a saved visitor choice
80
+ always takes priority. Layout's `accent` prop is likewise only the initial attribute: configure
81
+ the integration's `accent` to keep it at runtime.
82
+
83
+ **Script ownership:** Layout never renders FlavorScript. With the integration, do not add
84
+ FlavorScript. Without the integration, put FlavorScript in Layout's `head` slot yourself, because
85
+ Layout alone emits no flavor runtime. Stylesheets are likewise owned by the integration or by your
86
+ own imports.
87
+
88
+ Layout does not preload fonts. Importing the full CSS or `fonts.css` loads the three locally
89
+ bundled variable families: Space Grotesk (display), Inter (body) and Martian Mono (code).
90
+
91
+ ## FlavorScript without the integration
92
+
93
+ ```astro
94
+ ---
95
+ import '@nyxwire/css'
96
+ import Layout from '@nyxwire/astro/components/Layout.astro'
97
+ import FlavorScript from '@nyxwire/astro/components/FlavorScript.astro'
98
+ ---
99
+
100
+ <Layout title="Standalone page">
101
+ <FlavorScript slot="head" flavors={{ dark: 'twilight' }} accent="ice" />
102
+ <main><h1>Standalone page</h1></main>
103
+ </Layout>
104
+ ```
105
+
106
+ FlavorScript accepts the same options as the integration and emits an `is:inline` script. Its
107
+ `styles` and `css` props are validated but import nothing: standalone pages import CSS themselves.
108
+ Include it once, in the head, before paint.
109
+
110
+ ## FlavorSelect
111
+
112
+ FlavorSelect renders `<nw-flavor-select>`: a segmented control of native buttons (Auto, Abyss,
113
+ Nocturne, Twilight, Lumen) inside a labelled `role="group"`. Each button uses `aria-pressed`, the
114
+ group uses a roving tabindex, and Arrow keys, Home and End move and select. Button titles carry each
115
+ flavor's mood from the palette. `label` (default `Color flavor`) is the group's accessible name,
116
+ and `class` applies to the custom element.
117
+
118
+ The active option is highlighted from the `data-nw-flavor-preference` attribute on `<html>`, so it
119
+ is correct before the element hydrates. Every selector on the page stays in sync through the
120
+ `nyxwire:flavor` event. Listeners are removed when an element disconnects. Buttons stay disabled
121
+ until a runtime is available, including when JavaScript is disabled. Focus rings, hover states,
122
+ `prefers-reduced-motion` and forced-colors mode are handled with Nyxwire tokens.
123
+
124
+ ## Shared runtime API
125
+
126
+ The package root exports:
127
+
128
+ - Default `nyxwire(options?): AstroIntegration`.
129
+ - `buildFlavorScript(options?): string`: a validated, self-contained inline IIFE, also used by the
130
+ `@nyxwire/starlight` ThemeProvider.
131
+ - `resolveFlavor(stored, prefersLight, options?): FlavorName`: pure resolution; invalid or missing
132
+ storage falls back to `defaultFlavor`.
133
+ - `flavorRuntime(config: FlavorRuntimeConfig)`: the self-contained browser entry.
134
+ - `normalizeOptions`, `NyxwireOptionsError`, `isFlavorName`, `isFlavorPreference` and
135
+ `isAccentName`.
136
+ - `FLAVOR_STORAGE_KEY` (`nyxwire-flavor`), `ACCENT_STORAGE_KEY` (`nyxwire-accent`),
137
+ `FLAVOR_CHANGE_EVENT` (`nyxwire:flavor`, also exported as `FLAVOR_EVENT`), `flavorIds` /
138
+ `FLAVOR_IDS` and `darkFlavorIds`, all derived from the palette.
139
+ - Types `NyxwireOptions`, `NyxwireConfig` (alias `FlavorConfig`), `FlavorRuntimeConfig`,
140
+ `FlavorPreference`, `StyleMode`, `FlavorController`, `NyxwireRuntime`, `FlavorChangeDetail`,
141
+ `FlavorName`, `DarkFlavorName` and `AccentName`.
142
+
143
+ The runtime stores the preference under `nyxwire-flavor` (`auto`, `abyss`, `nocturne`,
144
+ `twilight` or `lumen`) and the accent under `nyxwire-accent`; Vue's `useFlavor` uses the same key.
145
+ Auto resolves `prefers-color-scheme: light` to the light flavor and anything else to the configured
146
+ dark flavor. The runtime sets `data-flavor`, `data-theme` (`dark` or `light`),
147
+ `data-nw-flavor-preference`, `data-accent` and `color-scheme` on `<html>`. Blocked storage (privacy
148
+ mode, sandboxed frames) still allows an in-memory choice. Only Auto follows later system changes.
149
+
150
+ ```js
151
+ window.nyxwire.getFlavor() // selected preference, including 'auto'
152
+ window.nyxwire.resolve() // resolved concrete flavor
153
+ window.nyxwire.setFlavor('twilight') // persists and applies
154
+ window.nyxwire.setFlavor('auto')
155
+ window.nyxwire.setAccent('volt') // persists and sets data-accent
156
+ window.nyxwire.setAccent(null) // removes data-accent (palette default)
157
+ window.nyxwire.getAccent()
158
+
159
+ document.addEventListener('nyxwire:flavor', ({ detail }) => {
160
+ console.log(detail.flavor, detail.resolved, detail.theme, detail.accent)
161
+ })
162
+ ```
163
+
164
+ The change event fires on initialization, on DOM readiness (so theme-color metadata parsed after
165
+ the script is updated), on explicit changes, and on system changes while Auto is selected.
166
+ Invalid programmatic flavors or accents throw before anything changes. Importing anything from
167
+ `@nyxwire/astro`, even `import type {} from '@nyxwire/astro'`, adds the `window.nyxwire` and
168
+ event typings.
169
+
170
+ ## Tailwind
171
+
172
+ Configure Tailwind v4 through its Vite plugin, then use this global CSS:
173
+
174
+ ```css
175
+ @import 'tailwindcss';
176
+ @import '@nyxwire/tailwind';
177
+ @import '@nyxwire/vue/tailwind.css';
178
+ ```
179
+
180
+ Use `styles: 'tokens'` if Tailwind owns your base and component styling, or `styles: false` if
181
+ your global CSS already imports tokens and fonts. FlavorSelect styles itself from tokens alone, so
182
+ it needs no component stylesheet. Starlight sites have their own layer order: use
183
+ `@nyxwire/starlight` for their document shell.
184
+
185
+ ## Vue islands
186
+
187
+ Configure `@astrojs/vue` alongside Nyxwire and import components from `@nyxwire/vue`. Render
188
+ static content through SSR, and add `client:visible` or `client:load` only to islands that need
189
+ interaction. Use `NwProvider` for the Vue component context. The head runtime applies flavor
190
+ attributes before islands hydrate, and both packages share the persisted flavor.
191
+
192
+ ## Verification
193
+
194
+ ```sh
195
+ pnpm build:astro
196
+ pnpm --filter @nyxwire/astro test
197
+ pnpm --filter @nyxwire/astro typecheck
198
+ pnpm build:docs
199
+ ```
200
+
201
+ The docs app (`apps/docs`) is the end-to-end surface: it renders the flavor runtime in a real
202
+ Astro build.
203
+
204
+ ## For AI agents
205
+
206
+ This package ships Markdown docs for its exact version in `dist/docs/`, so coding agents can read the API instead of guessing it. Run `npx @nyxwire/cli agents-md` in your project to index them in `AGENTS.md`; [AI tools](https://nyxwire.dissidence.ovh/getting-started/ai/) also covers the agent skill, the MCP server and llms.txt.
@@ -0,0 +1,93 @@
1
+ # Astro components
2
+
3
+ > Layout, FlavorSelect and FlavorScript from @nyxwire/astro, their props, keyboard behavior, and when to use each.
4
+
5
+ `@nyxwire/astro` ships three framework-free components. Import them by path:
6
+
7
+ ```astro
8
+ ---
9
+ import Layout from '@nyxwire/astro/components/Layout.astro'
10
+ import FlavorSelect from '@nyxwire/astro/components/FlavorSelect.astro'
11
+ import FlavorScript from '@nyxwire/astro/components/FlavorScript.astro'
12
+ ---
13
+ ```
14
+
15
+ ## Layout
16
+
17
+ A complete HTML document for pages outside Starlight. The body gets the canvas background, the body text color, the sans font and the base line height; it adds no grid and no landmarks, so your page owns its structure.
18
+
19
+ ```astro
20
+ <Layout title="Settings" description="Choose your appearance." class="settings">
21
+ <link slot="head" rel="icon" href="/favicon.svg" />
22
+ <main class="nw-container nw-stack">…</main>
23
+ </Layout>
24
+ ```
25
+
26
+ | Prop | Default | Effect |
27
+ | ------------- | ----------- | --------------------------------------------------------- |
28
+ | `title` | `'Nyxwire'` | The `<title>` |
29
+ | `description` | none | A `<meta name="description">` |
30
+ | `lang` | `'en'` | `lang` on `<html>` |
31
+ | `flavor` | none | Initial `data-flavor` and `data-theme` in the server HTML |
32
+ | `accent` | none | Initial `data-accent` in the server HTML |
33
+ | `class` | none | Classes on `<body>` |
34
+
35
+ The default slot is the page; the `head` slot adds elements to `<head>`. The document also declares `color-scheme: dark light` and a responsive viewport.
36
+
37
+ Without `flavor`, the server HTML carries no flavor attribute, so the CSS fallback applies without JavaScript (Nocturne, or Lumen for a light system), and two `theme-color` metas follow the system color scheme. With `flavor`, the HTML starts in that flavor and the single `theme-color` uses its base color. Either way, once a flavor runtime runs it owns the attributes and the meta. For a fixed starting flavor, also set `defaultFlavor` on the integration or on `FlavorScript`; a visitor's stored choice still wins. The `accent` prop is likewise only the initial attribute: configure the integration's `accent` to keep it at runtime.
38
+
39
+ Layout renders no flavor script and imports no CSS. The [integration](integration.md) provides both; without it, add `FlavorScript` and import the stylesheet yourself. It does not preload fonts either: the stylesheet loads the three bundled variable families (Space Grotesk, Inter and Martian Mono) when they are first used.
40
+
41
+ ## FlavorSelect
42
+
43
+ A segmented control of native buttons (Auto, Abyss, Nocturne, Twilight and Lumen) inside a labelled `role="group"`, wrapped in an `<nw-flavor-select>` custom element. It reads and sets the page runtime, and every instance on the page stays in sync through `nyxwire:flavor`. This one controls the site, like the selector in the header:
44
+
45
+ ```astro
46
+ <FlavorSelect label="Color flavor" class="settings-flavor" />
47
+ ```
48
+
49
+ | Prop | Default | Effect |
50
+ | ------- | ---------------- | ------------------------------------------- |
51
+ | `label` | `'Color flavor'` | Accessible name of the group |
52
+ | `class` | none | Classes on the `<nw-flavor-select>` element |
53
+
54
+ ### Keyboard and accessibility
55
+
56
+ | Key | Action |
57
+ | --------------------------------- | -------------------------------------------------------- |
58
+ | <kbd>Tab</kbd> | Moves focus to the active option, then out of the group |
59
+ | <kbd>→</kbd> <kbd>↓</kbd> | Selects and focuses the next option, wrapping around |
60
+ | <kbd>←</kbd> <kbd>↑</kbd> | Selects and focuses the previous option, wrapping around |
61
+ | <kbd>Home</kbd> <kbd>End</kbd> | Selects and focuses the first or last option |
62
+ | <kbd>Enter</kbd> <kbd>Space</kbd> | Selects the focused option |
63
+
64
+ - Each button reports its state with `aria-pressed`, and the group uses a roving `tabindex`, so it is one tab stop.
65
+ - Each button's `title` carries the flavor's mood from the palette.
66
+ - The active option is highlighted from the `data-nw-flavor-preference` attribute on `<html>`, which the runtime sets before the first paint, so it is correct before the element upgrades.
67
+ - The buttons stay disabled until a runtime is available, including when JavaScript is off.
68
+ - Focus rings, hover states, `prefers-reduced-motion` and forced-colors mode are handled with Nyxwire tokens. The control styles itself from tokens alone, so it needs no component stylesheet.
69
+ - Listeners are removed when the element disconnects.
70
+
71
+ ## FlavorScript
72
+
73
+ The flavor runtime as an inline `<script>`, for pages that do not use the integration. It accepts the [integration's options](integration.md#options) as props:
74
+
75
+ ```astro title="src/pages/standalone.astro"
76
+ ---
77
+ import '@nyxwire/css'
78
+ import Layout from '@nyxwire/astro/components/Layout.astro'
79
+ import FlavorScript from '@nyxwire/astro/components/FlavorScript.astro'
80
+ ---
81
+ <Layout title="Standalone page">
82
+ <FlavorScript slot="head" flavors={{ dark: 'twilight' }} accent="ice" />
83
+ <main class="nw-container">…</main>
84
+ </Layout>
85
+ ```
86
+
87
+ Put it once per page, in the head, so it runs before the first paint. Its `styles` and `css` props are validated but import nothing: import the CSS in the page or layout.
88
+
89
+ > **Caution**
90
+ >
91
+ > Do not combine `FlavorScript` with the integration, which already injects the same script into
92
+ > every page. On a Starlight site, the [`@nyxwire/starlight`](https://nyxwire.dissidence.ovh/starlight/setup/) plugin installs it
93
+ > too; use `FlavorScript` only on pages outside Starlight.
@@ -0,0 +1,71 @@
1
+ # Accessibility
2
+
3
+ > The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks.
4
+
5
+ Nyxwire guarantees what a palette can guarantee: every color meant for text is readable on the backgrounds it is meant for, in every flavor. The rest (focus, keyboard, motion, layout) is built into the components and is yours to keep when you compose them.
6
+
7
+ ## Contrast gate
8
+
9
+ `pnpm check:contrast` runs the palette gate and exits with an error on any failure, so a color that drops below its threshold cannot be released. The table recomputes the WCAG 2.x rules from the published palette when this site is built. Each cell shows the weakest pair the rule covers.
10
+
11
+ _Live example: [Accessibility](https://nyxwire.dissidence.ovh/foundations/accessibility/)._
12
+
13
+ The gate also checks two things the table cannot show:
14
+
15
+ - **Accent separation.** No two accents inside one flavor may come within ΔE<sub>OK</sub> 0.06, so `volt` never reads as `flare` at a different size and `ice` never collapses into `arc`.
16
+ - **Identity.** Every flavor's `base` stays at least 0.03 ΔE<sub>OK</sub> from sixteen popular dark and light themes (Static Bloom, Catppuccin, Rose Pine, Tokyo Night, Dracula, Nord and friends), with 0.045 as an advisory margin. The gate prints APCA Lc values for text roles as information.
17
+
18
+ What follows from the table:
19
+
20
+ - `text` is 7:1 (AAA) on `crust`, `mantle`, `base` and `surface0`, and 4.5:1 on the raised fills; `subtext1` and `subtext0` are body-safe on the page backgrounds.
21
+ - Every accent is AA on `crust`, `mantle`, `base` and `surface0`, so colored text, links and soft badges stay readable in any accent scope.
22
+ - Soft badges and buttons sit on a 16% tint of their own color, so their text mixes the intent with `fg` per flavor (`--nw-soft-ink`: 100% in Abyss, 90% in Nocturne, 75% in Twilight, 70% in Lumen). That keeps them AA on the same four grounds.
23
+ - `on-accent` text is AA on every solid accent fill, which covers solid buttons and badges.
24
+ - `overlay1` (`line-strong`) meets the 3:1 non-text minimum for input borders and control edges; `overlay0` (`line`) is decorative only, and the circuit grid sits on it by design.
25
+
26
+ > **Caution**
27
+ >
28
+ > These are solid-color guarantees. Text over imagery, colors at reduced opacity, and new color
29
+ > pairs need checking where you use them: put text on a solid, glass or cut panel when the backdrop
30
+ > is loud.
31
+
32
+ ## Focus
33
+
34
+ Every focusable element gets a visible ring on keyboard focus: the base layer styles `:focus-visible` with a 2px outline in `--nw-ring` (the primary intent, so it follows `data-accent`) at a 2px offset, and interactive components add their intent glow on top. Tab through these controls to see it:
35
+
36
+ ```html
37
+ <button type="button" class="nw-btn nw-btn-primary">
38
+ Solid
39
+ </button>
40
+ <button type="button" class="nw-btn nw-btn-outline nw-btn-secondary">
41
+ Outline
42
+ </button>
43
+ <a class="nw-link" href="#focus">
44
+ Link
45
+ </a>
46
+ <input class="nw-input" aria-label="Callsign" placeholder="Callsign" />
47
+ ```
48
+
49
+ Tokens: `--nw-ring`, `--nw-ring-width` (2px) and `--nw-ring-offset` (2px). Do not remove the outline; restyle it through the tokens instead.
50
+
51
+ ## Keyboard
52
+
53
+ - **CSS components** build on native elements (`<button>`, `<a>`, `<details>`, `<dialog>`, `<meter>`, the Popover API), so keyboard behavior comes from the browser.
54
+ - **Vue components** wrap [Reka UI](https://reka-ui.com/) primitives: arrow-key roving focus in toolbars and toggle groups, typeahead in lists, Escape to close the topmost overlay, focus trapped inside dialogs and returned to the trigger on close, and the ARIA roles and states each pattern needs.
55
+ - Icon-only buttons need an accessible name: give them `aria-label`.
56
+
57
+ ## Motion
58
+
59
+ Decorative animation stops under `prefers-reduced-motion: reduce`: durations collapse to 0.01ms, loops run once, and `.nw-motion-essential` opts meaning-bearing motion (a spinner for pending work) back in. See [Effects & motion](effects-motion.md#motion).
60
+
61
+ ## Forced colors
62
+
63
+ Under `forced-colors: active` the motif utilities fall back to system colors: cut and wire surfaces become a plain `Canvas` box with a real border, the scanline overlay and circuit grid are removed, and buttons keep their state through `Highlight`/`HighlightText` rather than color. Disabled controls show as `GrayText`.
64
+
65
+ ## Color is never the only signal
66
+
67
+ Intent colors always travel with words or icons: alerts have titles, badges have text, meters show their value, and form errors are written out under the field with `aria-invalid` set. Keep that pairing when you compose your own components.
68
+
69
+ ## Targets
70
+
71
+ Control heights are 1.75rem (`xs`), 2rem (`sm`), 2.5rem (`md`, the default) and 3rem (`lg`), above the 24px WCAG 2.2 minimum. Inputs are 2.5rem tall. On touch layouts, prefer `md` or larger.
@@ -0,0 +1,114 @@
1
+ # Color roles
2
+
3
+ > Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette.
4
+
5
+ Components never reference a raw palette color. They use semantic roles, which resolve to a palette color in the nearest flavor scope. The same names work as CSS variables (`--nw-canvas`) and as Tailwind color keys (`bg-canvas`, `text-fg-muted`, `border-line-strong`). Raw palette keys carry an `nw-` prefix in Tailwind (`bg-nw-indigo`) so the neutral named `base` cannot collide with `text-base`.
6
+
7
+ ## Semantic tokens
8
+
9
+ Generated from `semanticRoles`. The swatches are the token resolved in each flavor.
10
+
11
+ | CSS variable | Tailwind key | Palette | Abyss | Nocturne | Twilight | Lumen |
12
+ | --- | --- | --- | --- | --- | --- | --- |
13
+ | `--nw-canvas` | `canvas` | `base` | `#080720` | `#14093e` | `#271a4b` | `#eae6ff` |
14
+ | `--nw-canvas-subtle` | `canvas-subtle` | `mantle` | `#050419` | `#0e0533` | `#211540` | `#dedaff` |
15
+ | `--nw-canvas-sunken` | `canvas-sunken` | `crust` | `#030312` | `#0a0329` | `#1b1136` | `#d3cefa` |
16
+ | `--nw-panel` | `panel` | `surface0` | `#12122f` | `#1d154c` | `#312457` | `#ddd9ff` |
17
+ | `--nw-panel-hover` | `panel-hover` | `surface1` | `#1b1c3b` | `#272258` | `#3b2f61` | `#d1cdf8` |
18
+ | `--nw-panel-active` | `panel-active` | `surface2` | `#262747` | `#302d60` | `#453b6a` | `#c6c1ef` |
19
+ | `--nw-fg` | `fg` | `text` | `#f0f1f7` | `#f2f3fa` | `#f5f4fa` | `#1f0e47` |
20
+ | `--nw-fg-muted` | `fg-muted` | `subtext1` | `#d0d2dd` | `#d4d4e3` | `#d9d7e4` | `#3d326b` |
21
+ | `--nw-fg-subtle` | `fg-subtle` | `subtext0` | `#aeb0c1` | `#b2b4ca` | `#bab7cd` | `#524a7e` |
22
+ | `--nw-fg-faint` | `fg-faint` | `overlay2` | `#82849b` | `#8b8cab` | `#9793af` | `#686191` |
23
+ | `--nw-fg-disabled` | `fg-disabled` | `overlay1` | `#646781` | `#6c6d93` | `#7c7799` | `#7c76a4` |
24
+ | `--nw-line` | `line` | `overlay0` | `#3e415f` | `#464673` | `#59517a` | `#b0abd9` |
25
+ | `--nw-line-strong` | `line-strong` | `overlay1` | `#646781` | `#6c6d93` | `#7c7799` | `#7c76a4` |
26
+ | `--nw-line-bright` | `line-bright` | `overlay2` | `#82849b` | `#8b8cab` | `#9793af` | `#686191` |
27
+ | `--nw-primary` | `primary` | `indigo` | `#848fff` | `#848fff` | `#848fff` | `#4940d7` |
28
+ | `--nw-secondary` | `secondary` | `synth` | `#ff47d8` | `#ff47d8` | `#ff47d8` | `#a8008b` |
29
+ | `--nw-tertiary` | `tertiary` | `ice` | `#5eddfe` | `#5eddfe` | `#5eddfe` | `#006081` |
30
+ | `--nw-info` | `info` | `arc` | `#4aa9ff` | `#4aa9ff` | `#4aa9ff` | `#0055b6` |
31
+ | `--nw-success` | `success` | `matrix` | `#4bf677` | `#4bf677` | `#4bf677` | `#00680f` |
32
+ | `--nw-warning` | `warning` | `volt` | `#f8e445` | `#f8e445` | `#f8e445` | `#6e5700` |
33
+ | `--nw-danger` | `danger` | `alarm` | `#ff5d7b` | `#ff5d7b` | `#ff5d7b` | `#b6002c` |
34
+ | `--nw-ring` | `ring` | `indigo` | `#848fff` | `#848fff` | `#848fff` | `#4940d7` |
35
+ | `--nw-link` | `link` | `iris` | `#cdc0ff` | `#cdc0ff` | `#cdc0ff` | `#6746a7` |
36
+
37
+ - **Surfaces**: `canvas` is the page; `canvas-subtle` holds sidebars, navigation and inputs; `canvas-sunken` holds app chrome, HUD backdrops and code. `panel` raises cards, menus and popovers, with `panel-hover` and `panel-active` for interaction.
38
+ - **Text**: `fg` for body text, `fg-muted` for secondary text, `fg-subtle` for placeholders, `fg-faint` for icons and comments, `fg-disabled` for disabled controls.
39
+ - **Lines**: `line` for decorative hairlines and the circuit grid, `line-strong` for component boundaries such as input borders (3:1 or better), `line-bright` for emphasis.
40
+ - **Intents**: `primary` (or the `data-accent` choice), `secondary`, `tertiary`, `info`, `success`, `warning`, `danger`. `ring` follows `primary`; `link` stays `iris` so links keep their color under any accent.
41
+
42
+ ## Derived tokens
43
+
44
+ These are built with `color-mix()` in `@nyxwire/css` and have no palette entry of their own.
45
+
46
+ | CSS variable | Value | Tailwind key |
47
+ | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
48
+ | `--nw-on-<intent>` | `--nw-on-accent`: text on a solid intent fill (`crust` on dark flavors, `base` on Lumen) | `on-primary`, `on-secondary`, `on-tertiary`, `on-info`, `on-success`, `on-warning`, `on-danger` |
49
+ | `--nw-<intent>-soft` | intent at 16% over transparent | `primary-soft`, `secondary-soft`, `tertiary-soft`, `info-soft`, `success-soft`, `warning-soft`, `danger-soft` |
50
+ | `--nw-soft-ink` | share of the intent in text on its own soft tint, the rest is `fg`: 100% in Abyss, 90% in Nocturne, 75% in Twilight, 70% in Lumen | none (CSS only) |
51
+ | `--nw-selection` | `primary` at 32% | `selection` |
52
+ | `--nw-backdrop` | `shadow-ink` at up to 72%, behind dialogs | `backdrop` |
53
+ | `--nw-glass` | `canvas` at 78%, for panels over imagery | `glass` |
54
+ | `--nw-shadow-ink` | `crust` on dark flavors, `text` on Lumen; the ink of shadows and scrims | `shadow-ink` |
55
+
56
+ ## Accents
57
+
58
+ Every accent passes 4.5:1 on `crust`, `mantle`, `base` and `surface0` in its flavor, so any of them can be used for text. Meanings stay stable across flavors:
59
+
60
+ | Accent | Roles | CSS variable | Tailwind key | Nocturne | Lumen |
61
+ | --- | --- | --- | --- | --- | --- |
62
+ | indigo | `primary`, `ring` | `--nw-indigo` | `nw-indigo` | `#848fff` | `#4940d7` |
63
+ | iris | `link` | `--nw-iris` | `nw-iris` | `#cdc0ff` | `#6746a7` |
64
+ | flux | | `--nw-flux` | `nw-flux` | `#d071ff` | `#8c16c5` |
65
+ | synth | `secondary` | `--nw-synth` | `nw-synth` | `#ff47d8` | `#a8008b` |
66
+ | alarm | `danger` | `--nw-alarm` | `nw-alarm` | `#ff5d7b` | `#b6002c` |
67
+ | flare | | `--nw-flare` | `nw-flare` | `#ff9845` | `#9d3a00` |
68
+ | volt | `warning` | `--nw-volt` | `nw-volt` | `#f8e445` | `#6e5700` |
69
+ | matrix | `success` | `--nw-matrix` | `nw-matrix` | `#4bf677` | `#00680f` |
70
+ | circuit | | `--nw-circuit` | `nw-circuit` | `#17edd5` | `#006558` |
71
+ | ice | `tertiary` | `--nw-ice` | `nw-ice` | `#5eddfe` | `#006081` |
72
+ | arc | `info` | `--nw-arc` | `nw-arc` | `#4aa9ff` | `#0055b6` |
73
+ | steel | | `--nw-steel` | `nw-steel` | `#b5bdd5` | `#4d5976` |
74
+
75
+ ## Syntax roles
76
+
77
+ Generated from `syntaxRoles` and used by the [Expressive Code themes](https://nyxwire.dissidence.ovh/starlight/setup/) of the Starlight plugin. Code backgrounds are `crust`; dark flavors share the token colors.
78
+
79
+ | Role | Palette | Style | Nocturne | Lumen |
80
+ | --- | --- | --- | --- | --- |
81
+ | `keyword` | `flux` | | `#d071ff` | `#8c16c5` |
82
+ | `storage` | `synth` | | `#ff47d8` | `#a8008b` |
83
+ | `modifier` | `synth` | | `#ff47d8` | `#a8008b` |
84
+ | `string` | `matrix` | | `#4bf677` | `#00680f` |
85
+ | `number` | `flare` | | `#ff9845` | `#9d3a00` |
86
+ | `constant` | `flare` | | `#ff9845` | `#9d3a00` |
87
+ | `boolean` | `alarm` | | `#ff5d7b` | `#b6002c` |
88
+ | `null` | `alarm` | | `#ff5d7b` | `#b6002c` |
89
+ | `function` | `arc` | | `#4aa9ff` | `#0055b6` |
90
+ | `method` | `arc` | | `#4aa9ff` | `#0055b6` |
91
+ | `type` | `volt` | | `#f8e445` | `#6e5700` |
92
+ | `class` | `volt` | | `#f8e445` | `#6e5700` |
93
+ | `interface` | `volt` | | `#f8e445` | `#6e5700` |
94
+ | `enum` | `volt` | | `#f8e445` | `#6e5700` |
95
+ | `namespace` | `volt` | | `#f8e445` | `#6e5700` |
96
+ | `variable` | `text` | | `#f2f3fa` | `#1f0e47` |
97
+ | `parameter` | `iris` | | `#cdc0ff` | `#6746a7` |
98
+ | `property` | `ice` | | `#5eddfe` | `#006081` |
99
+ | `tag` | `synth` | | `#ff47d8` | `#a8008b` |
100
+ | `attribute` | `circuit` | | `#17edd5` | `#006558` |
101
+ | `operator` | `circuit` | | `#17edd5` | `#006558` |
102
+ | `punctuation` | `overlay2` | | `#8b8cab` | `#686191` |
103
+ | `comment` | `overlay2` | italic | `#8b8cab` | `#686191` |
104
+ | `regex` | `circuit` | | `#17edd5` | `#006558` |
105
+ | `escape` | `synth` | | `#ff47d8` | `#a8008b` |
106
+ | `decorator` | `synth` | | `#ff47d8` | `#a8008b` |
107
+ | `markup-heading` | `indigo` | | `#848fff` | `#4940d7` |
108
+ | `markup-link` | `iris` | | `#cdc0ff` | `#6746a7` |
109
+ | `inserted` | `matrix` | | `#4bf677` | `#00680f` |
110
+ | `deleted` | `alarm` | | `#ff5d7b` | `#b6002c` |
111
+ | `changed` | `volt` | | `#f8e445` | `#6e5700` |
112
+ | `editor-bg` | `crust` | | `#0a0329` | `#d3cefa` |
113
+ | `selection` | `indigo` | 30% opacity | `#848fff` | `#4940d7` |
114
+ | `line-highlight` | `surface0` | | `#1d154c` | `#ddd9ff` |