@nyxwire/starlight 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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +221 -2
  3. package/dist/config.d.ts +9 -0
  4. package/dist/config.js +32 -0
  5. package/dist/docs/foundations/accessibility.md +71 -0
  6. package/dist/docs/foundations/color-roles.md +114 -0
  7. package/dist/docs/foundations/effects-motion.md +150 -0
  8. package/dist/docs/foundations/flavors.md +156 -0
  9. package/dist/docs/foundations/icons.md +45 -0
  10. package/dist/docs/foundations/palette.md +180 -0
  11. package/dist/docs/foundations/spacing-elevation.md +168 -0
  12. package/dist/docs/foundations/typography.md +80 -0
  13. package/dist/docs/index.md +51 -0
  14. package/dist/docs/kitchen-sink.md +283 -0
  15. package/dist/docs/manifest.json +61 -0
  16. package/dist/docs/setup.md +190 -0
  17. package/dist/ec-themes.d.ts +443 -0
  18. package/dist/ec-themes.js +217 -0
  19. package/dist/expressive-code.d.ts +75 -0
  20. package/dist/expressive-code.js +101 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.js +25 -0
  23. package/dist/options.d.ts +29 -0
  24. package/dist/options.js +56 -0
  25. package/dist/runtime.d.ts +16 -0
  26. package/dist/runtime.js +52 -0
  27. package/dist/theme-bridge.d.ts +27 -0
  28. package/dist/theme-bridge.js +73 -0
  29. package/package.json +67 -3
  30. package/src/chrome.css +191 -0
  31. package/src/components/ThemeProvider.astro +15 -0
  32. package/src/components/ThemeSelect.astro +51 -0
  33. package/src/components/env.d.ts +5 -0
  34. package/src/config.ts +53 -0
  35. package/src/content-components.css +154 -0
  36. package/src/ec-themes.ts +246 -0
  37. package/src/expressive-code.ts +115 -0
  38. package/src/index.ts +32 -0
  39. package/src/options.ts +80 -0
  40. package/src/prose.css +108 -0
  41. package/src/runtime.ts +67 -0
  42. package/src/theme-bridge.css +130 -0
  43. package/src/theme-bridge.ts +89 -0
  44. package/styles.css +299 -0
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,222 @@
1
- # Temporary Holding Version
1
+ # @nyxwire/starlight
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
+ Starlight 0.42 plugin that themes every Starlight surface with Nyxwire: page chrome, search,
4
+ sidebar, table of contents, content typography, asides, badges, cards, tabs, steps, file trees,
5
+ pagination, hero, banner and Expressive Code blocks. It adds a flavor selector (Auto, Abyss,
6
+ Nocturne, Twilight, Lumen) and per-flavor code themes generated from the palette. Fonts are bundled
7
+ locally; nothing loads from a CDN.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ pnpm add @nyxwire/starlight
13
+ ```
14
+
15
+ Peer dependencies: `astro` 7 and `@astrojs/starlight` 0.42 or later.
16
+
17
+ ## Usage
18
+
19
+ ```js
20
+ // astro.config.mjs
21
+ import { defineConfig } from 'astro/config'
22
+ import starlight from '@astrojs/starlight'
23
+ import nyxwireStarlight from '@nyxwire/starlight'
24
+
25
+ export default defineConfig({
26
+ integrations: [
27
+ starlight({
28
+ title: 'My docs',
29
+ plugins: [nyxwireStarlight({ flavors: { dark: 'nocturne' }, accent: 'indigo' })],
30
+ customCss: ['./src/styles/custom.css'],
31
+ }),
32
+ ],
33
+ })
34
+ ```
35
+
36
+ During `config:setup` the plugin:
37
+
38
+ - prepends `@nyxwire/starlight/styles.css` to `customCss`, so your stylesheets load after it
39
+ and win;
40
+ - overrides the `ThemeProvider` component and, with `flavorSelect`, the `ThemeSelect` component,
41
+ keeping every other component override you configured;
42
+ - sets the Expressive Code themes, theme selector and `styleOverrides` (see below);
43
+ - registers a Vite virtual module (`virtual:nyxwire/starlight-runtime`) that hands the configured
44
+ flavor runtime to the ThemeProvider.
45
+
46
+ If you already override `ThemeProvider` or `ThemeSelect`, your component is kept and the plugin
47
+ logs a warning. Nyxwire's ThemeSelect needs Nyxwire's ThemeProvider runtime.
48
+
49
+ ## Options
50
+
51
+ Invalid values and unknown keys throw `NyxwireStarlightOptionsError` when the plugin is created.
52
+ Flavor and accent rules are shared with `@nyxwire/astro`.
53
+
54
+ | Option | Values | Default |
55
+ | ---------------- | ------------------------------------------------------------------------------------------------------- | ---------- |
56
+ | `flavors.dark` | `abyss`, `nocturne`, `twilight` | `nocturne` |
57
+ | `flavors.light` | `lumen` | `lumen` |
58
+ | `defaultFlavor` | `auto`, `abyss`, `nocturne`, `twilight`, `lumen` | `auto` |
59
+ | `accent` | `indigo`, `iris`, `flux`, `synth`, `alarm`, `flare`, `volt`, `matrix`, `circuit`, `ice`, `arc`, `steel` | none |
60
+ | `flavorSelect` | `true`, `false` | `true` |
61
+ | `expressiveCode` | `true`, `false` | `true` |
62
+
63
+ `flavors.dark` is the flavor Auto uses when the system prefers dark, and the flavor Starlight's
64
+ "Dark" choice maps to. `defaultFlavor` applies when the visitor has no stored choice. `accent`
65
+ re-points the primary color (links, active states, focus rings). Without it, the palette default
66
+ (indigo) applies. Accent swaps affect the UI, not the syntax colors.
67
+
68
+ ## Flavor runtime and selector
69
+
70
+ The ThemeProvider override inlines a script in `<head>` that runs before first paint. The script
71
+ reads the stored preference (`localStorage["nyxwire-flavor"]`: `auto`, `abyss`, `nocturne`,
72
+ `twilight` or `lumen`) and resolves Auto through `prefers-color-scheme`. It then sets several
73
+ attributes on `<html>`:
74
+
75
+ - `data-flavor`, which the Nyxwire tokens and the code themes read;
76
+ - `data-theme` (`dark` or `light`), which Starlight reads;
77
+ - `data-accent` and `color-scheme`.
78
+
79
+ It also keeps `<meta name="theme-color">` on the active flavor's base color. This is the same
80
+ runtime as `@nyxwire/astro`, so the preference is shared with Astro pages and Vue's `useFlavor`:
81
+
82
+ ```js
83
+ window.nyxwire.setFlavor('abyss')
84
+ document.addEventListener('nyxwire:flavor', ({ detail }) => {
85
+ console.log(detail.flavor, detail.resolved, detail.theme, detail.accent)
86
+ })
87
+ ```
88
+
89
+ The ThemeSelect override renders Starlight's own select, wrapped in `<nw-starlight-flavor-select>`,
90
+ with Auto and the four flavors. It is labelled through Starlight's UI strings
91
+ (`themeSelect.accessibleLabel`, `themeSelect.auto`) and keeps native keyboard behavior. Its width
92
+ grows to fit long localized labels. The header and mobile-menu instances stay in sync, and the
93
+ stored flavor is shown before first paint.
94
+
95
+ `window.StarlightThemeProvider.updatePickers()` stays available for Starlight-compatible code.
96
+ With `flavorSelect: false`, Starlight's dark/light/auto select keeps working: its choices map to
97
+ `flavors.dark`, `flavors.light` and Auto. The plugin mirrors the preference into Starlight's
98
+ `starlight-theme` key. A visitor's earlier Starlight dark/light choice is adopted once, when no
99
+ flavor has been stored yet.
100
+
101
+ ## Expressive Code
102
+
103
+ Unless you pass `expressiveCode: false` (to the plugin or to Starlight), the plugin configures:
104
+
105
+ - `themes`: one VS Code theme object per flavor, the configured dark flavor first, generated from
106
+ `@nyxwire/palette` `syntaxRoles` (keywords flux, strings matrix, comments italic overlay2, and
107
+ so on). Syntax ink is lifted to at least 5.5:1 on each flavor's dimmest code surface.
108
+ - `themeCssSelector`: each theme applies under `[data-flavor='<flavor>']`, so code blocks switch
109
+ with the flavor, not just with dark/light. `useStarlightDarkModeSwitch`,
110
+ `useStarlightUiThemeColors` and `useDarkModeMediaQuery` are turned off accordingly.
111
+ - `styleOverrides`: these point code backgrounds, borders, frames, title bars, copy buttons and
112
+ text markers at CSS variables (`var(--nw-canvas-sunken)`, `var(--nw-line)`, `var(--nw-panel)`,
113
+ `var(--nw-font-mono)`, `var(--nw-radius-lg)`), so code blocks follow the active flavor and accent
114
+ at runtime.
115
+ - `minSyntaxHighlightingColorContrast: 4.5`: the generated themes already meet a stricter bar, so
116
+ this WCAG AA floor only affects themes you supply.
117
+
118
+ Your own Expressive Code options win. User `themes` replace the generated ones, and the flavor
119
+ selector is then dropped. User `styleOverrides` are merged over the plugin's, per group for
120
+ `frames` and `textMarkers`. Everything except `themeCssSelector` is plain JSON. If you render
121
+ `<Code>` components and Expressive Code asks for an `ec.config.mjs`, move the plugin's
122
+ Expressive Code options there with `createExpressiveCodeOptions`.
123
+
124
+ The themes are also exported for other Expressive Code or Shiki setups:
125
+
126
+ ```js
127
+ import {
128
+ createCodeThemes,
129
+ createExpressiveCodeTheme,
130
+ nyxwireDark,
131
+ nyxwireLight,
132
+ } from '@nyxwire/starlight'
133
+
134
+ const twilightTheme = createExpressiveCodeTheme('twilight') // raw palette colors
135
+ const rendered = createCodeThemes('abyss') // contrast-adjusted, one per flavor
136
+ ```
137
+
138
+ ## Tailwind in Starlight
139
+
140
+ `@astrojs/starlight-tailwind` is optional. To use Nyxwire's Tailwind theme and the Vue
141
+ components on a Starlight site, add a global stylesheet to `customCss`. It loads after the
142
+ plugin's stylesheet:
143
+
144
+ ```css
145
+ /* src/styles/global.css */
146
+ @layer base, starlight, theme, components, utilities;
147
+ @import 'tailwindcss/theme.css' layer(theme);
148
+ @import 'tailwindcss/utilities.css' layer(utilities);
149
+ @import '@nyxwire/tailwind';
150
+ @import '@nyxwire/vue/tailwind.css';
151
+
152
+ @layer base {
153
+ *,
154
+ ::before,
155
+ ::after {
156
+ border: 0 solid;
157
+ }
158
+ }
159
+ ```
160
+
161
+ Tailwind's preflight is left out on purpose: Starlight ships its own reset.
162
+
163
+ ## Customizing
164
+
165
+ `styles.css` declares the page's layer order:
166
+ `base < starlight (base, reset, core, content, components, utils, nyxwire) < theme < nyxwire-print < components < utilities`.
167
+
168
+ - Starlight variables (`--sl-color-*`, `--sl-shadow-*`, `--sl-font`, `--sl-font-mono`, the
169
+ `--sl-text-*` scale and line heights) are mapped to Nyxwire tokens in unlayered CSS
170
+ (`src/theme-bridge.css`). Override them in your own unlayered CSS, which loads later and wins.
171
+ - Component restyles (`src/chrome.css`, `src/prose.css`, `src/content-components.css` and the rules
172
+ in `styles.css`) live in `@layer starlight.nyxwire`. Any unlayered rule, or a rule in a later
173
+ layer such as Tailwind's `utilities`, overrides them.
174
+ - To restyle Starlight and Nyxwire components together, change colors at the token level
175
+ (`--nw-primary`, `--nw-canvas`, and so on). A nested `data-flavor` or `data-accent` attribute
176
+ scopes a region to another flavor or accent.
177
+ - The theme carries Nyxwire's motifs: a wire-gradient header edge, wire-bordered cards and link
178
+ cards, cut-corner asides, glass surfaces, and gradient hero titles.
179
+ - Printing uses the Lumen palette, matching Starlight's light print stylesheet. Component restyles
180
+ apply to screens only.
181
+ - Transitions respect `prefers-reduced-motion`. In forced-colors mode, cards and asides fall back
182
+ to system borders, and the current page and selected tab get an outline.
183
+
184
+ ## API
185
+
186
+ The package root exports:
187
+
188
+ - the default plugin, also named `nyxwireStarlight`;
189
+ - options: `normalizeStarlightOptions` and `NyxwireStarlightOptionsError`;
190
+ - config: `createConfigUpdate`, plus the specifiers `PACKAGE_NAME`, `STYLES_ENTRY`,
191
+ `THEME_PROVIDER_COMPONENT` and `THEME_SELECT_COMPONENT`;
192
+ - Expressive Code: `createExpressiveCodeOptions`, `mergeStyleOverrides`,
193
+ `expressiveCodeStyleOverrides` and `MIN_SYNTAX_CONTRAST`;
194
+ - code themes: `createExpressiveCodeTheme`, `createCodeTheme`, `createCodeThemes`,
195
+ `flavorThemeSelector`, `nyxwireDark`, `nyxwireLight` and `TOKEN_SCOPES`;
196
+ - runtime: `buildThemeProviderScript`, `createThemeRuntime`, `createRuntimeIntegration`,
197
+ `RUNTIME_MODULE_ID` and `STARLIGHT_THEME_STORAGE_KEY`;
198
+ - types: `NyxwireStarlightOptions`, `NyxwireStarlightConfig`,
199
+ `NyxwireExpressiveCodeTheme`, `ExpressiveCodeTokenColor`, `TokenRoleName`,
200
+ `StarlightConfigUpdate`, `StarlightThemeRuntime`, `StarlightThemeBridgeConfig`, `AccentName`,
201
+ `DarkFlavorName` and `FlavorName`.
202
+
203
+ Other entry points: `@nyxwire/starlight/styles.css` and
204
+ `@nyxwire/starlight/components/{ThemeProvider,ThemeSelect}.astro`.
205
+
206
+ ## Verification
207
+
208
+ ```sh
209
+ pnpm build:starlight
210
+ pnpm --filter @nyxwire/starlight test
211
+ pnpm --filter @nyxwire/starlight typecheck
212
+ pnpm build:docs
213
+ ```
214
+
215
+ `test/fixture` is a minimal Starlight site using the plugin (`pnpm exec astro build --root
216
+ test/fixture` from the package directory). The docs app (`apps/docs`) is the end-to-end surface:
217
+ its `/starlight/kitchen-sink/` page exercises every Starlight component and Markdown element with
218
+ this theme, and its `ec.config.mjs` shows the Expressive Code setup that `<Code>` components need.
219
+
220
+ ## For AI agents
221
+
222
+ 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,9 @@
1
+ import type { StarlightUserConfig } from '@astrojs/starlight/types';
2
+ import type { NyxwireStarlightConfig } from './options.js';
3
+ export declare const PACKAGE_NAME = "@nyxwire/starlight";
4
+ export declare const STYLES_ENTRY = "@nyxwire/starlight/styles.css";
5
+ export declare const THEME_PROVIDER_COMPONENT = "@nyxwire/starlight/components/ThemeProvider.astro";
6
+ export declare const THEME_SELECT_COMPONENT = "@nyxwire/starlight/components/ThemeSelect.astro";
7
+ export type StarlightConfigUpdate = Pick<StarlightUserConfig, 'customCss' | 'components' | 'expressiveCode'>;
8
+ /** The Starlight config update applied by the plugin's `config:setup` hook. */
9
+ export declare function createConfigUpdate(user: StarlightUserConfig, config: NyxwireStarlightConfig, warn: (message: string) => void): StarlightConfigUpdate;
package/dist/config.js ADDED
@@ -0,0 +1,32 @@
1
+ import { createExpressiveCodeOptions } from './expressive-code.js';
2
+ export const PACKAGE_NAME = '@nyxwire/starlight';
3
+ export const STYLES_ENTRY = `${PACKAGE_NAME}/styles.css`;
4
+ export const THEME_PROVIDER_COMPONENT = `${PACKAGE_NAME}/components/ThemeProvider.astro`;
5
+ export const THEME_SELECT_COMPONENT = `${PACKAGE_NAME}/components/ThemeSelect.astro`;
6
+ const OVERRIDES = {
7
+ ThemeProvider: THEME_PROVIDER_COMPONENT,
8
+ ThemeSelect: THEME_SELECT_COMPONENT,
9
+ };
10
+ function override(name, current, warn) {
11
+ const ours = OVERRIDES[name];
12
+ if (current === undefined || current === ours)
13
+ return ours;
14
+ warn(`Keeping your ${name} override (${current}). Nyxwire's ${name} (${ours}) is skipped, so ` +
15
+ 'custom theme components must retain the Nyxwire ThemeProvider runtime if they replace it.');
16
+ return current;
17
+ }
18
+ /** The Starlight config update applied by the plugin's `config:setup` hook. */
19
+ export function createConfigUpdate(user, config, warn) {
20
+ const components = {
21
+ ...user.components,
22
+ ThemeProvider: override('ThemeProvider', user.components?.ThemeProvider, warn),
23
+ };
24
+ if (config.flavorSelect) {
25
+ components.ThemeSelect = override('ThemeSelect', user.components?.ThemeSelect, warn);
26
+ }
27
+ const customCss = [STYLES_ENTRY, ...(user.customCss ?? []).filter((id) => id !== STYLES_ENTRY)];
28
+ const expressiveCode = createExpressiveCodeOptions(user.expressiveCode, config);
29
+ return expressiveCode === undefined
30
+ ? { customCss, components }
31
+ : { customCss, components, expressiveCode };
32
+ }
@@ -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](../setup.md) 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` |
@@ -0,0 +1,150 @@
1
+ # Effects & motion
2
+
3
+ > Cut corners, the wire edge, neon glow, scanlines, the circuit grid, glitch, glass, and motion tokens that respect reduced motion.
4
+
5
+ The effects are the identity: cut corners, a wire edge, neon glow, scanlines, a circuit grid and a hover glitch. Use them as accents on a few elements, not as texture for every surface. The examples use the CSS utility classes; the Tailwind equivalents are on [Utilities & variants](https://nyxwire.dissidence.ovh/tailwind/utilities/).
6
+
7
+ ## Glow
8
+
9
+ Glow is a colored shadow built from `--nw-glow-color`, which defaults to the primary intent. Its strength is `--nw-glow-strength`: 1 on the dark flavors, 0.45 on Lumen, where a full glow would smudge.
10
+
11
+ ```html
12
+ <div class="nw-docs-tile nw-docs-tile-neon nw-glow-sm">
13
+ nw-glow-sm <code>--nw-glow-sm</code>
14
+ </div>
15
+ <div class="nw-docs-tile nw-docs-tile-neon nw-glow-md">
16
+ nw-glow-md <code>--nw-glow-md</code>
17
+ </div>
18
+ <div class="nw-docs-tile nw-docs-tile-neon nw-glow-lg">
19
+ nw-glow-lg <code>--nw-glow-lg</code>
20
+ </div>
21
+ <div class="nw-docs-tile nw-docs-tile-neon nw-glow-md nw-glow-info">nw-glow-info</div>
22
+ <div class="nw-docs-tile nw-docs-tile-neon nw-glow-md nw-glow-success">nw-glow-success</div>
23
+ <div class="nw-docs-tile nw-docs-tile-neon nw-glow-md nw-glow-danger">nw-glow-danger</div>
24
+ ```
25
+
26
+ Pick a color with `.nw-glow-<intent>` (the seven intents), or set `--nw-glow-color` yourself. In Tailwind, `glow-<color>` accepts every palette and semantic color (`glow-matrix`, `glow-info`), and `text-glow` / `text-glow-<color>` put the same bloom on text. The glow tokens are declared on every element, so changing the color on one element rebuilds its own glow. Components already glow on hover and focus in their intent color.
27
+
28
+ ```html
29
+ <p class="nw-h3 nw-text-glow" style="color: var(--nw-primary)">
30
+ Text glow follows the accent
31
+ </p>
32
+ <p class="nw-h3 nw-text-glow" style="color: var(--nw-info)">
33
+ or any color you pick
34
+ </p>
35
+ <p class="nw-display text-wire">Nyxwire</p>
36
+ ```
37
+
38
+ `text-wire` (Tailwind) clips `--nw-gradient-wire` (135°, primary to secondary) to the glyphs; `bg-wire` paints the same gradient as a fill.
39
+
40
+ ## Cut corners
41
+
42
+ `.nw-cut` chamfers the top-right and bottom-left corners, sized by `--nw-cut` (10px). The element paints its own chamfered fill and stays unclipped, and `::before` draws the 1px edge, so a glow still fits in the box: `clip-path` would clip a `box-shadow`, so the cut utilities swap to a `drop-shadow` filter instead.
43
+
44
+ ```html
45
+ <div class="nw-docs-tile nw-cut">
46
+ nw-cut <code>panel fill, line edge</code>
47
+ </div>
48
+ <div
49
+ class="nw-docs-tile nw-cut"
50
+ style="--nw-fill: var(--nw-canvas-sunken); --nw-edge: var(--nw-line-strong)"
51
+ >
52
+ custom <code>--nw-fill / --nw-edge</code>
53
+ </div>
54
+ <div class="nw-docs-tile nw-cut nw-glow-sm">
55
+ cut + glow <code>filter, not box-shadow</code>
56
+ </div>
57
+ <div class="nw-docs-tile nw-cut nw-wire">
58
+ cut + wire <code>gradient edge</code>
59
+ </div>
60
+ ```
61
+
62
+ Paint the fill through `--nw-fill` (a flat color, default panel) and the edge through `--nw-edge` (any paint, default line), not through `background` and `border`. Replaced elements (`img`, `video`, `svg`) have no pseudo-elements, so they are clipped directly and cannot glow; wrap one to give it a glow. Forced-colors mode falls back to a plain system-colored box with a real border.
63
+
64
+ ## Wire edge
65
+
66
+ `.nw-wire` draws a 1px border in `--nw-gradient-wire`, primary toward the top left and secondary opposite, over an opaque `--nw-fill`; `.nw-wire-glow` adds the matching bloom. On a cut surface the wire becomes the edge paint, which also works over a translucent fill. Buttons (`.nw-btn-wire`), cards and HUD panels have wire variants.
67
+
68
+ ```html
69
+ <div class="nw-docs-tile nw-wire">
70
+ nw-wire <code>1px gradient border</code>
71
+ </div>
72
+ <div class="nw-docs-tile nw-wire nw-wire-glow">
73
+ nw-wire-glow <code>bloom follows the wire</code>
74
+ </div>
75
+ ```
76
+
77
+ ## Scanlines, grid and glitch
78
+
79
+ ```html
80
+ <div class="nw-docs-tile nw-scanlines">
81
+ nw-scanlines <code>pointer-transparent overlay</code>
82
+ </div>
83
+ <div class="nw-docs-tile nw-grid-bg" style="background-color: var(--nw-canvas-sunken)">
84
+ nw-grid-bg <code>--nw-grid-size 32px</code>
85
+ </div>
86
+ <a class="nw-link nw-glitch" href="#scanlines-grid-and-glitch">
87
+ nw-glitch <code>hover or focus me</code>
88
+ </a>
89
+ <div class="nw-docs-tile nw-cut nw-scanlines nw-glow-sm">
90
+ All three <code>cut, scanlines, glow</code>
91
+ </div>
92
+ ```
93
+
94
+ | Class | Effect | Tune with |
95
+ | --------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------- |
96
+ | `.nw-scanlines` | Horizontal lines from `--nw-scanlines` in a pointer-transparent `::after` | the shadow ink and flavor; lines are 3px apart |
97
+ | `.nw-grid-bg` | Circuit grid: lines every `--nw-grid-size`, a node on every fourth crossing | `--nw-grid-size` (32px), `--nw-grid-line` |
98
+ | `.nw-glitch` | One 480ms chromatic burst when the text, or the link or button around it, is hovered or focused | disabled under reduced motion |
99
+
100
+ Cut and scanlines combine (the overlay is clipped to the chamfer); the grid paints `background`, so it does not combine with cut or wire, which paint `background` too. Glitch splits the text in the secondary and tertiary colors with a step timing function.
101
+
102
+ ## Glass
103
+
104
+ `glass` (a Tailwind utility) is `--nw-glass` (canvas at 78%) with a `--nw-blur-md` backdrop blur, for panels over imagery or busy backdrops. Its legibility depends on the flavor and the scene behind it: put text on a solid or cut panel when the backdrop is loud, and check the pair where you use it.
105
+
106
+ ```html
107
+ <div class="nw-docs-tile glass">
108
+ glass <code>canvas at 78% + blur</code>
109
+ </div>
110
+ <div class="nw-docs-tile nw-cut" style="--nw-fill: var(--nw-glass)">
111
+ cut + glass fill <code>translucent --nw-fill</code>
112
+ </div>
113
+ ```
114
+
115
+ Blur tokens: `--nw-blur-sm` 4px, `--nw-blur-md` 12px, `--nw-blur-lg` 24px.
116
+
117
+ ## Motion
118
+
119
+ Motion answers an interaction or a state change. Durations and easings are tokens:
120
+
121
+ | Duration | Value | Easing | Curve |
122
+ | ----------------------- | ----- | -------------------- | ----------------------------------- |
123
+ | `--nw-duration-instant` | 80ms | `--nw-ease-standard` | `cubic-bezier(0.2, 0, 0, 1)` |
124
+ | `--nw-duration-fast` | 140ms | `--nw-ease-out` | `cubic-bezier(0.16, 1, 0.3, 1)` |
125
+ | `--nw-duration-base` | 220ms | `--nw-ease-in` | `cubic-bezier(0.7, 0, 0.84, 0)` |
126
+ | `--nw-duration-slow` | 360ms | `--nw-ease-in-out` | `cubic-bezier(0.65, 0, 0.35, 1)` |
127
+ | `--nw-duration-slower` | 560ms | `--nw-ease-back` | `cubic-bezier(0.34, 1.56, 0.64, 1)` |
128
+
129
+ Hover and color changes use `fast` with `standard`; entrances use `base` with `out`; exits use `fast` with `in`; a small overshoot (`back`) suits elements that pop in. Keyframes ship as `nw-spin`, `nw-pulse`, `nw-glow-pulse`, `nw-shimmer`, `nw-fade-in`, `nw-fade-out`, `nw-zoom-in`, `nw-zoom-out`, `nw-slide-in-from-{top,bottom,left,right}` and `nw-slide-out-to-{top,bottom,left,right}`; the slides travel `--nw-slide-distance` (0.5rem for a popover, 100% for a drawer). In Tailwind they are `animate-*` utilities of the same names.
130
+
131
+ ```html
132
+ <div
133
+ class="nw-docs-tile nw-docs-tile-neon"
134
+ style="animation: nw-glow-pulse 2s var(--nw-ease-standard) infinite"
135
+ >
136
+ nw-glow-pulse <code>alarms, live states</code>
137
+ </div>
138
+ <div class="nw-docs-tile" style="animation: nw-pulse 2s var(--nw-ease-standard) infinite">
139
+ nw-pulse <code>idle work, skeletons</code>
140
+ </div>
141
+ ```
142
+
143
+ > **Note: Reduced motion**
144
+ >
145
+ > Under `prefers-reduced-motion: reduce`, the duration tokens drop to 0.01ms and every animation and
146
+ > transition jumps to its end state, so `animationend` and `transitionend` still fire. Add
147
+ > `.nw-motion-essential` to an element whose motion carries meaning, such as a spinner for pending
148
+ > work. The switch lives in `@nyxwire/css` base, which the full bundle and the `@nyxwire/tailwind`
149
+ > entry both import; import the Tailwind theme alone and Tailwind animations follow the browser
150
+ > defaults, so bring the base import or your own switch.