@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
@@ -0,0 +1,51 @@
1
+ # @nyxwire/starlight 0.1.0
2
+
3
+ Nyxwire's Starlight theme: every docs surface, the code blocks and the flavor switch in Nyxwire's identity.
4
+
5
+ ## Install
6
+
7
+ 1. Install the plugin next to Starlight.
8
+
9
+ ```sh
10
+ pnpm add @nyxwire/starlight
11
+ ```
12
+
13
+ 2. Add it to Starlight's `plugins`.
14
+
15
+ ```js title="astro.config.mjs" ins={3,9}
16
+ import { defineConfig } from 'astro/config'
17
+ import starlight from '@astrojs/starlight'
18
+ import nyxwireStarlight from '@nyxwire/starlight'
19
+
20
+ export default defineConfig({
21
+ integrations: [
22
+ starlight({
23
+ title: 'My docs',
24
+ plugins: [nyxwireStarlight()],
25
+ }),
26
+ ],
27
+ })
28
+ ```
29
+
30
+ The plugin themes the whole site, swaps the theme picker for a flavor picker and generates code themes from the palette's syntax roles. More in [Starlight setup](setup.md).
31
+
32
+ ## Conventions
33
+
34
+ - Add `nyxwireStarlight()` from `@nyxwire/starlight` to the `plugins` of `starlight({ ... })`: it themes every surface, replaces the theme picker with a flavor picker and generates code themes from the palette.
35
+ - Do not add `@nyxwire/astro`'s integration as well: the plugin brings the flavor runtime.
36
+ - Markdown content keeps Starlight's own components (asides, tabs, cards); see [kitchen-sink.md](kitchen-sink.md).
37
+
38
+ ## Files
39
+
40
+ Every file below documents @nyxwire/starlight 0.1.0. Read the ones you need before writing code.
41
+
42
+ - [foundations/accessibility.md](foundations/accessibility.md): The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks.
43
+ - [foundations/color-roles.md](foundations/color-roles.md): Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette.
44
+ - [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.
45
+ - [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.
46
+ - [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.
47
+ - [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.
48
+ - [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.
49
+ - [foundations/typography.md](foundations/typography.md): Three bundled variable fonts, the type scale, heading roles and the typography classes.
50
+ - [kitchen-sink.md](kitchen-sink.md): Every Starlight UI element and Markdown element rendered with the Nyxwire theme, for visual checks across all four flavors.
51
+ - [setup.md](setup.md): Theme a Starlight 0.42 site with the @nyxwire/starlight plugin, choose its options, and add Tailwind, nw-* demos and Vue islands to the docs.
@@ -0,0 +1,283 @@
1
+ # Starlight kitchen sink
2
+
3
+ > Every Starlight UI element and Markdown element rendered with the Nyxwire theme, for visual checks across all four flavors.
4
+
5
+ This page renders every Starlight building block with the Nyxwire plugin: **strong text**, _emphasis_, ~~struck text~~, `inline code`, a [link to the code blocks](#code-blocks), <mark>highlighted text</mark>, H<sub>2</sub>O and 10<sup>3</sup>, an <abbr title="Head-up display">HUD</abbr>, and the shortcut <kbd>Ctrl</kbd> + <kbd>K</kbd> that opens search.
6
+
7
+ ## Asides
8
+
9
+ > **Note**
10
+ >
11
+ > A **note** with `inline code` and [a link](#badges). Notes map to the info intent.
12
+
13
+ > **Tip**
14
+ >
15
+ > A **tip**. Tips work well for optional shortcuts.
16
+
17
+ > **Caution: Watch the glow budget**
18
+ >
19
+ > Every glowing element adds a shadow layer to paint. Keep glow for the one control that matters on
20
+ > a screen.
21
+
22
+ > **Danger**
23
+ >
24
+ > Never set `--nw-fill` to a translucent color on a non-cut `wire` element: the gradient border
25
+ > shows through the fill.
26
+ >
27
+ > | Element | Opaque fill required |
28
+ > | ---------- | -------------------- |
29
+ > | `wire` | yes |
30
+ > | `cut wire` | no |
31
+
32
+ :::note[Markdown directive]
33
+ Asides also come from the `:::note` directive syntax.
34
+ :::
35
+
36
+ :::caution
37
+ A caution from a directive, with no custom title.
38
+ :::
39
+
40
+ ## Badges
41
+
42
+ **Default** **Note** **Tip**
43
+ **Success** **Caution**
44
+ **Danger**
45
+
46
+ **Small**
47
+ **Medium**
48
+ **Large**
49
+
50
+ ### Badge in a heading **v0.1**
51
+
52
+ ## Cards
53
+
54
+ **Flavors**
55
+
56
+ Abyss, Nocturne and Twilight share the neon accents; Lumen brings a deeper set for daylight.
57
+
58
+ **Palette**
59
+
60
+ Twenty-four colors per flavor, frozen as hex.
61
+
62
+ **Components**
63
+
64
+ CSS classes, Tailwind utilities and Vue components share one look.
65
+
66
+ **Astro**
67
+
68
+ An integration with a flash-free flavor runtime.
69
+
70
+ **Offline**
71
+
72
+ Local fonts and no CDN: everything ships with the packages.
73
+
74
+ ## Link cards
75
+
76
+ - [Home](https://nyxwire.dissidence.ovh/): Back to the splash page.
77
+ - [Astro components](https://nyxwire.dissidence.ovh/astro/components/): Layout, FlavorSelect and FlavorScript outside Starlight.
78
+
79
+ ## Link buttons
80
+
81
+ [Primary action](https://nyxwire.dissidence.ovh/)
82
+ [Secondary](setup.md)
83
+ [Minimal](#tabs)
84
+
85
+ ## Tabs
86
+
87
+ #### pnpm
88
+
89
+ ```sh
90
+ pnpm add @nyxwire/starlight
91
+ ```
92
+
93
+ #### npm
94
+
95
+ ```sh
96
+ npm install @nyxwire/starlight
97
+ ```
98
+
99
+ #### Bun
100
+
101
+ ```sh
102
+ bun add @nyxwire/starlight
103
+ ```
104
+
105
+ ## Steps
106
+
107
+ 1. Install the plugin next to Starlight.
108
+
109
+ ```sh
110
+ pnpm add @nyxwire/starlight
111
+ ```
112
+
113
+ 2. Register `nyxwireStarlight()` in the Starlight `plugins` array.
114
+
115
+ 3. Pick a flavor in the header. The choice persists in `localStorage`.
116
+
117
+ ## File tree
118
+
119
+ - astro.config.mjs register the plugin here
120
+ - src/
121
+ - content/
122
+ - docs/
123
+ - **index.mdx**
124
+ - starlight/
125
+ - kitchen-sink.mdx
126
+ - styles/
127
+ - global.css
128
+ - package.json
129
+ - …
130
+
131
+ ## Icons
132
+
133
+ <div class="not-content sl-flex" style="gap: 1rem; align-items: center; flex-wrap: wrap">
134
+ (Star icon)
135
+ (Rocket icon)
136
+ (Moon icon)
137
+ (Sun icon)
138
+ (Check icon)
139
+ (Warning icon)
140
+ </div>
141
+
142
+ ## Code blocks
143
+
144
+ ```ts title="flavor.ts" {3-4} ins={9} del={8} "setFlavor"
145
+ import type { FlavorName } from '@nyxwire/palette'
146
+
147
+ // Comments use overlay2 in italics.
148
+ const storageKey = 'nyxwire-flavor'
149
+
150
+ export function choose(flavor: FlavorName, retries = 3): boolean {
151
+ if (retries <= 0) return false
152
+ window.nyxwire?.setFlavor('auto')
153
+ window.nyxwire?.setFlavor(flavor)
154
+ return /^(abyss|nocturne|twilight|lumen)$/.test(flavor) && storageKey.length > 0
155
+ }
156
+ ```
157
+
158
+ ```sh frame="terminal" title="Build the docs"
159
+ pnpm build:docs
160
+ pnpm --filter @nyxwire/starlight test
161
+ ```
162
+
163
+ ```css
164
+ :root {
165
+ --nw-glow-color: var(--nw-primary); /* neon */
166
+ color-scheme: dark;
167
+ }
168
+
169
+ .nw-btn:hover {
170
+ box-shadow: var(--nw-glow-sm);
171
+ }
172
+ ```
173
+
174
+ ```json title="package.json"
175
+ {
176
+ "name": "my-docs",
177
+ "private": true,
178
+ "type": "module",
179
+ "dependencies": {
180
+ "@astrojs/starlight": "^0.42.10",
181
+ "@nyxwire/starlight": "^0.1.0"
182
+ }
183
+ }
184
+ ```
185
+
186
+ ```diff lang="ts"
187
+ const flavor = resolveFlavor(stored, prefersLight)
188
+ -root.dataset.theme = 'dark'
189
+ +root.dataset.theme = flavorMeta[flavor].dark ? 'dark' : 'light'
190
+ ```
191
+
192
+ ```vue title="FlavorBadge.vue"
193
+ <script setup lang="ts">
194
+ defineProps<{ flavor: string }>()
195
+ </script>
196
+
197
+ <template>
198
+ <span class="nw-badge nw-badge-soft" :data-flavor="flavor">{{ flavor }}</span>
199
+ </template>
200
+ ```
201
+
202
+ ```html title="index.html" wrap
203
+ <html lang="en" data-flavor="nocturne" data-accent="indigo">
204
+ <body class="bg-canvas text-fg">
205
+ <a class="nw-link" href="/status">A long link that wraps instead of scrolling.</a>
206
+ </body>
207
+ </html>
208
+ ```
209
+
210
+ ## Tables
211
+
212
+ | Flavor | Role | Base | Text | Order |
213
+ | -------- | ---------------------- | --------- | --------- | ----: |
214
+ | Abyss | Dense dashboards, HUDs | `#080720` | `#f0f1f7` | 0 |
215
+ | Nocturne | Default dark | `#14093e` | `#f2f3fa` | 1 |
216
+ | Twilight | Softest dark | `#271a4b` | `#f5f4fa` | 2 |
217
+ | Lumen | Light | `#eae6ff` | `#1f0e47` | 3 |
218
+
219
+ ## Blockquote
220
+
221
+ > The grid never sleeps; it just changes flavor.
222
+ >
223
+ > Nyxwire has a neon for every hour, from abyss to lumen.
224
+
225
+ ## Keyboard
226
+
227
+ Open search with <kbd>Ctrl</kbd> + <kbd>K</kbd> (or <kbd>⌘</kbd> <kbd>K</kbd> on macOS) and close it with <kbd>Esc</kbd>.
228
+
229
+ ## Details
230
+
231
+ <details>
232
+ <summary>What changes between dark flavors?</summary>
233
+
234
+ Only the neutral ramp: Abyss is near-black indigo, Nocturne deep electric indigo and Twilight a dusky violet. Accents are identical.
235
+
236
+ </details>
237
+
238
+ ## Images
239
+
240
+ ![A white wire trace with two bends on a deep indigo background](data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20240%2080%22%3E%3Crect%20width%3D%22240%22%20height%3D%2280%22%20fill%3D%22%2314093e%22%2F%3E%3Cpath%20d%3D%22M0%2040h60l20-20h80l20%2020h60%22%20fill%3D%22none%22%20stroke%3D%22%23f2f3fa%22%20stroke-width%3D%222%22%2F%3E%3C%2Fsvg%3E)
241
+
242
+ ## Lists
243
+
244
+ - Unordered list items take a primary marker.
245
+ - Nested lists keep the same rhythm:
246
+ - Abyss
247
+ - Nocturne
248
+ - Last item.
249
+
250
+ 1. Ordered lists use mono numerals.
251
+ 2. Second step.
252
+ 3. Third step.
253
+
254
+ - [x] Task lists render checkboxes.
255
+ - [ ] Unchecked tasks too.
256
+
257
+ ## Footnotes
258
+
259
+ The flavor runtime runs before the first paint.[^1]
260
+
261
+ [^1]: It is an inline script in `<head>`, so no stylesheet or island waits for it.
262
+
263
+ ## Heading levels
264
+
265
+ ### Level three heading
266
+
267
+ Body copy under a level three heading.
268
+
269
+ #### Level four heading
270
+
271
+ Body copy under a level four heading.
272
+
273
+ ##### Level five heading
274
+
275
+ Body copy under a level five heading.
276
+
277
+ ###### Level six heading
278
+
279
+ Body copy under a level six heading.
280
+
281
+ ---
282
+
283
+ The horizontal rule above uses the hairline token.
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@nyxwire/starlight",
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/starlight 0.1.0",
48
+ "description": "Setup, conventions and the list of every doc file."
49
+ },
50
+ {
51
+ "path": "kitchen-sink.md",
52
+ "title": "Starlight kitchen sink",
53
+ "description": "Every Starlight UI element and Markdown element rendered with the Nyxwire theme, for visual checks across all four flavors."
54
+ },
55
+ {
56
+ "path": "setup.md",
57
+ "title": "Starlight setup",
58
+ "description": "Theme a Starlight 0.42 site with the @nyxwire/starlight plugin, choose its options, and add Tailwind, nw-* demos and Vue islands to the docs."
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,190 @@
1
+ # Starlight setup
2
+
3
+ > Theme a Starlight 0.42 site with the @nyxwire/starlight plugin, choose its options, and add Tailwind, nw-* demos and Vue islands to the docs.
4
+
5
+ `@nyxwire/starlight` is a Starlight plugin. It restyles every Starlight surface (header, search, sidebar, table of contents, content, asides, badges, cards, tabs, steps, file trees, pagination, hero, banner and code blocks), replaces the theme picker with a flavor picker, and generates one code theme per flavor from the palette. This site uses it with the default options.
6
+
7
+ 1. Install the plugin next to Starlight. It needs `astro` 7 and `@astrojs/starlight` 0.42 or later.
8
+
9
+ ```sh
10
+ pnpm add @nyxwire/starlight
11
+ ```
12
+
13
+ 2. Add it to Starlight's `plugins`, not as a second Astro integration.
14
+
15
+ ```js title="astro.config.mjs" ins={3,9}
16
+ import { defineConfig } from 'astro/config'
17
+ import starlight from '@astrojs/starlight'
18
+ import nyxwireStarlight from '@nyxwire/starlight'
19
+
20
+ export default defineConfig({
21
+ integrations: [
22
+ starlight({
23
+ title: 'My docs',
24
+ plugins: [nyxwireStarlight()],
25
+ }),
26
+ ],
27
+ })
28
+ ```
29
+
30
+ When Starlight sets up, the plugin:
31
+
32
+ - puts `@nyxwire/starlight/styles.css` first in `customCss`, so your own stylesheets load after it and win;
33
+ - overrides the `ThemeProvider` component and, unless `flavorSelect` is off, the `ThemeSelect` component, keeping every other override you configured;
34
+ - sets the Expressive Code themes, theme selector and style overrides;
35
+ - hands the configured flavor runtime to its `ThemeProvider` through the Vite virtual module `virtual:nyxwire/starlight-runtime`.
36
+
37
+ If you already override `ThemeProvider` or `ThemeSelect`, your component is kept and the plugin logs a warning. Nyxwire's `ThemeSelect` needs Nyxwire's `ThemeProvider` runtime.
38
+
39
+ ## Options
40
+
41
+ ```js
42
+ nyxwireStarlight({
43
+ flavors: { dark: 'abyss', light: 'lumen' },
44
+ defaultFlavor: 'auto',
45
+ accent: 'ice',
46
+ flavorSelect: true,
47
+ expressiveCode: true,
48
+ })
49
+ ```
50
+
51
+ | Option | Values | Default |
52
+ | ---------------- | ---------------------------------------------------------- | ------------ |
53
+ | `flavors.dark` | `'abyss'`, `'nocturne'`, `'twilight'` | `'nocturne'` |
54
+ | `flavors.light` | `'lumen'` | `'lumen'` |
55
+ | `defaultFlavor` | `'auto'`, `'abyss'`, `'nocturne'`, `'twilight'`, `'lumen'` | `'auto'` |
56
+ | `accent` | any of the [12 accents](foundations/color-roles.md) | none |
57
+ | `flavorSelect` | `true`, `false` | `true` |
58
+ | `expressiveCode` | `true`, `false` | `true` |
59
+
60
+ `flavors.dark` is the flavor Auto uses on a dark system, and the one Starlight's "Dark" choice maps to. `defaultFlavor` applies when the visitor has no stored choice. `accent` re-points the primary color: links, the active sidebar entry, focus rings and glow. Without it the palette default, indigo, applies. Invalid values or unknown keys throw a `NyxwireStarlightOptionsError` when the plugin is created; the flavor and accent rules are shared with `@nyxwire/astro`.
61
+
62
+ ## Flavor runtime and picker
63
+
64
+ The `ThemeProvider` override inlines the [flavor runtime](https://nyxwire.dissidence.ovh/astro/integration/#the-flavor-runtime) in `<head>`, followed by a small Starlight bridge, so the stored flavor applies before the first paint. It sets `data-flavor` (which the Nyxwire tokens and the code themes read), `data-theme` (which Starlight reads), `data-accent` and `color-scheme` on `<html>`, keeps `<meta name="theme-color">` on the active flavor's base color, and exposes `window.nyxwire`. Astro pages and Vue islands on the same origin share the choice, stored under `nyxwire-flavor`.
65
+
66
+ ```ts title="flavor.ts" "setFlavor"
67
+ import type {} from '@nyxwire/astro'
68
+
69
+ window.nyxwire?.setFlavor('abyss') // persists and applies
70
+ ```
71
+
72
+ The `ThemeSelect` override is Starlight's own `<select>`, wrapped in `<nw-starlight-flavor-select>`, with Auto and the four flavors; the header and mobile-menu copies stay in sync, and the stored flavor shows before the first paint. It keeps the native keyboard behavior and grows to fit long localized labels. Its labels come from Starlight's UI strings, so you can rename it through the `i18n` collection:
73
+
74
+ ```ts title="src/content.config.ts"
75
+ import { defineCollection } from 'astro:content'
76
+ import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders'
77
+ import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'
78
+
79
+ export const collections = {
80
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
81
+ i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }),
82
+ }
83
+ ```
84
+
85
+ ```json title="src/content/i18n/en.json"
86
+ {
87
+ "themeSelect.accessibleLabel": "Select flavor",
88
+ "themeSelect.auto": "System"
89
+ }
90
+ ```
91
+
92
+ With `flavorSelect: false`, Starlight's dark, light and auto picker stays and keeps working: its choices map to `flavors.dark`, `flavors.light` and Auto. Either way, the plugin mirrors the flavor into Starlight's `starlight-theme` storage key, adopts a visitor's earlier Starlight dark or light choice once if no flavor was stored yet, and keeps `window.StarlightThemeProvider.updatePickers()` available for code that calls it.
93
+
94
+ ## Expressive Code
95
+
96
+ Unless `expressiveCode` is `false` on the plugin, or Expressive Code is turned off in Starlight, the plugin configures code blocks:
97
+
98
+ - **Themes.** One VS Code theme per flavor, the configured dark flavor first, generated from the palette's [syntax roles](foundations/color-roles.md): keywords in flux, strings in matrix, functions in arc, types in volt, comments in italic `overlay2`. Syntax ink is lifted to at least 5.5:1 on each flavor's dimmest code surface.
99
+ - **Selector.** Each theme applies under `[data-flavor='<flavor>']`, so code blocks switch with the flavor, not just with dark and light. Starlight's own dark-mode switch, UI theme colors and dark-mode media query are turned off accordingly.
100
+ - **Style overrides.** Code backgrounds, borders, frames, title bars, the copy button and text markers point at CSS variables (`var(--nw-canvas-sunken)`, `var(--nw-line)`, `var(--nw-panel)`, `var(--nw-font-mono)`, `var(--nw-radius-lg)`), so every block follows the active flavor and accent without a rebuild.
101
+ - **Contrast.** `minSyntaxHighlightingColorContrast` is 4.5. The generated themes already meet a stricter bar, so this WCAG AA floor only affects themes you supply.
102
+
103
+ Your own Expressive Code options win: `themes` replace the generated ones (and the flavor selector is then dropped), and `styleOverrides` merge over the plugin's, group by group for `frames` and `textMarkers`. Everything except `themeCssSelector` is plain JSON; if you render `<Code>` components and Expressive Code asks for an `ec.config.mjs`, move the options there with `createExpressiveCodeOptions`. The themes are exported for other Expressive Code or Shiki setups:
104
+
105
+ ```js
106
+ import {
107
+ createCodeThemes,
108
+ createExpressiveCodeTheme,
109
+ nyxwireDark,
110
+ nyxwireLight,
111
+ } from '@nyxwire/starlight'
112
+
113
+ const twilightTheme = createExpressiveCodeTheme('twilight') // raw palette colors
114
+ const rendered = createCodeThemes('abyss') // contrast-adjusted, one per flavor
115
+ ```
116
+
117
+ `nyxwireDark` is the Nocturne theme and `nyxwireLight` the Lumen one.
118
+
119
+ ## Tailwind in Starlight
120
+
121
+ To use the Tailwind theme and the Vue components on a Starlight site, add a stylesheet to `customCss`. The plugin's stylesheet still loads first.
122
+
123
+ ```css title="src/styles/global.css"
124
+ @layer base, starlight, theme, components, utilities;
125
+ @import 'tailwindcss/theme.css' layer(theme);
126
+ @import 'tailwindcss/utilities.css' layer(utilities);
127
+ @import '@nyxwire/tailwind';
128
+ @import '@nyxwire/vue/tailwind.css';
129
+
130
+ @layer base {
131
+ *,
132
+ ::before,
133
+ ::after {
134
+ border: 0 solid;
135
+ }
136
+ }
137
+ ```
138
+
139
+ ```js title="astro.config.mjs"
140
+ starlight({
141
+ plugins: [nyxwireStarlight()],
142
+ customCss: ['./src/styles/global.css'],
143
+ })
144
+ ```
145
+
146
+ Tailwind's preflight is left out because Starlight ships its own reset; the border reset is the one piece Tailwind's border utilities need. Register `@tailwindcss/vite` in `vite.plugins`. `@astrojs/starlight-tailwind` is compatible but not required.
147
+
148
+ ### nw-\* demos in content
149
+
150
+ These docs also render the framework-free [CSS components](https://nyxwire.dissidence.ovh/css-components/) inside pages. Their stylesheet imports the component and utility layers of `@nyxwire/css` next to the theme:
151
+
152
+ ```css title="src/styles/global.css"
153
+ @import '@nyxwire/css/components.css';
154
+ @import '@nyxwire/css/utilities.css';
155
+ ```
156
+
157
+ and wraps every live example in an element with the `not-content` class, which keeps Starlight's content typography (margins, heading and link styles) out of it:
158
+
159
+ ```html
160
+ <div class="not-content">
161
+ <button class="nw-btn">Connect</button>
162
+ </div>
163
+ ```
164
+
165
+ ### Vue islands
166
+
167
+ Add `@astrojs/vue` to the integrations and use the components as [islands](https://nyxwire.dissidence.ovh/astro/vue-islands/). Do not add the `@nyxwire/astro` integration to a Starlight site: the plugin's `ThemeProvider` already installs the runtime.
168
+
169
+ ## Layers and overrides
170
+
171
+ The plugin's stylesheet declares the page's layer order:
172
+
173
+ ```css
174
+ @layer base, starlight, theme, nyxwire-print, components, utilities;
175
+ /* starlight: base, reset, core, content, components, utils, nyxwire */
176
+ ```
177
+
178
+ - Starlight's variables (`--sl-color-*`, `--sl-shadow-*`, `--sl-font`, `--sl-font-mono`, the `--sl-text-*` scale and line heights) are mapped to Nyxwire tokens in unlayered CSS. Override one in your own unlayered CSS, which loads later and wins.
179
+ - The component restyles live in `@layer starlight.nyxwire`. Any unlayered rule, or a rule in a later layer such as Tailwind's `utilities`, beats them.
180
+ - To recolor Starlight and the Nyxwire components together, change the tokens (`--nw-primary`, `--nw-canvas`, …) rather than the `--sl-*` variables. A nested `data-flavor` or `data-accent` attribute restyles one region.
181
+ - The theme carries Nyxwire's motifs: a wire-gradient header edge, wire-bordered cards and link cards, cut-corner asides, glass surfaces and gradient hero titles.
182
+ - Printing uses the Lumen palette, matching Starlight's light print stylesheet; component restyles apply to screens only.
183
+ - Transitions respect `prefers-reduced-motion`. In forced-colors mode, cards and asides fall back to system borders, and the current page and the selected tab get an outline.
184
+
185
+ > **Note**
186
+ >
187
+ > The [kitchen sink](kitchen-sink.md) renders every Starlight component and Markdown
188
+ > element with the theme. Switch the flavor in the header there to check them all at once.
189
+
190
+ - [Kitchen sink](kitchen-sink.md): Every Starlight component rendered with the Nyxwire theme, across all four flavors.