From 241c1efc5de7911225148cda5a2a4afdaa176618 Mon Sep 17 00:00:00 2001 From: tgiachi Date: Thu, 12 Nov 2026 12:10:36 +0100 Subject: [PATCH] feat(web): Neon theme - colour in the surfaces too: deep indigo ground, saturated violet panels, electric yellow accent - checked by the same contrast test as the other themes - README lists six themes --- README.md | 2 +- web/src/i18n/locales/en.json | 3 ++- web/src/i18n/locales/it.json | 3 ++- web/src/index.css | 2 +- web/src/pages/SettingsPage.test.tsx | 4 ++-- web/src/theme/theme.test.ts | 4 ++-- web/src/theme/theme.ts | 3 ++- web/src/theme/themes.css | 25 ++++++++++++++++++++++++- 8 files changed, 36 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c67aa41..b4d04ee 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,7 @@ npm install SONDA_URL=http://127.0.0.1:8080 npm run dev # open http://localhost:5173, /api is proxied to Sonda ``` -What it does today: sign in (and create the first account of a new server), browse artists, albums and songs, search, and play with a queue, shuffle, repeat, media keys and a full-screen player. Artist pages show the Wikipedia text, similar artists and tags when those providers are on, each with its credit, and the photo credit next to the photo. It reports one listen per play. There are five themes (Sonda, Tokyo Night, Gruvbox dark, Gruvbox light and Dracula) and two languages (English and Italian), both chosen in Settings. +What it does today: sign in (and create the first account of a new server), browse artists, albums and songs, search, and play with a queue, shuffle, repeat, media keys and a full-screen player. Artist pages show the Wikipedia text, similar artists and tags when those providers are on, each with its credit, and the photo credit next to the photo. It reports one listen per play. There are six themes (Sonda, Tokyo Night, Gruvbox dark, Gruvbox light, Dracula and Neon) and two languages (English and Italian), both chosen in Settings. More commands, all run in `web/`: `npm test`, `npm run build`, and `npm run gen:api`, which rebuilds `src/api/schema.d.ts` from the OpenAPI spec (it fetches the generator with `npx`, so it needs the network once). Discover, the admin screens and serving the app from the binary come later. diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 6705983..3524951 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -117,7 +117,8 @@ "tokyo-night": "Tokyo Night", "gruvbox-dark": "Gruvbox dark", "gruvbox-light": "Gruvbox light", - "dracula": "Dracula" + "dracula": "Dracula", + "neon": "Neon" }, "lang": { "en": "English", diff --git a/web/src/i18n/locales/it.json b/web/src/i18n/locales/it.json index c7a8d05..ab82b72 100644 --- a/web/src/i18n/locales/it.json +++ b/web/src/i18n/locales/it.json @@ -117,7 +117,8 @@ "tokyo-night": "Tokyo Night", "gruvbox-dark": "Gruvbox scuro", "gruvbox-light": "Gruvbox chiaro", - "dracula": "Dracula" + "dracula": "Dracula", + "neon": "Neon" }, "lang": { "en": "English", diff --git a/web/src/index.css b/web/src/index.css index 98b89db..56f5018 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -11,7 +11,7 @@ @import "./theme/themes.css"; /* The dark variant follows the theme, not the OS setting. */ -@custom-variant dark (&:is([data-theme="sonda"] *, [data-theme="tokyo-night"] *, [data-theme="gruvbox-dark"] *, [data-theme="dracula"] *)); +@custom-variant dark (&:is([data-theme="sonda"] *, [data-theme="tokyo-night"] *, [data-theme="gruvbox-dark"] *, [data-theme="dracula"] *, [data-theme="neon"] *)); @theme inline { --font-heading: var(--font-sans); diff --git a/web/src/pages/SettingsPage.test.tsx b/web/src/pages/SettingsPage.test.tsx index ae277e8..db500ab 100644 --- a/web/src/pages/SettingsPage.test.tsx +++ b/web/src/pages/SettingsPage.test.tsx @@ -59,11 +59,11 @@ test('each group of choices has a label you can see, not only one for screen rea expect(screen.getByRole('radiogroup', { name: 'Language' })).toBeInTheDocument() }) -test('all five themes can be chosen and the current one is selected', async () => { +test('all six themes can be chosen and the current one is selected', async () => { renderSettings() const group = screen.getByRole('radiogroup', { name: 'Theme' }) expect(group).toBeInTheDocument() - for (const name of ['Sonda', 'Tokyo Night', 'Gruvbox dark', 'Gruvbox light', 'Dracula']) { + for (const name of ['Sonda', 'Tokyo Night', 'Gruvbox dark', 'Gruvbox light', 'Dracula', 'Neon']) { expect(screen.getByRole('radio', { name })).toBeInTheDocument() } expect(screen.getByRole('radio', { name: 'Sonda' })).toBeChecked() diff --git a/web/src/theme/theme.test.ts b/web/src/theme/theme.test.ts index d0a7cc5..a369b76 100644 --- a/web/src/theme/theme.test.ts +++ b/web/src/theme/theme.test.ts @@ -9,8 +9,8 @@ afterEach(() => { vi.restoreAllMocks() }) -test('there are five themes and sonda comes first', () => { - expect(THEMES.map((t) => t.id)).toEqual(['sonda', 'tokyo-night', 'gruvbox-dark', 'gruvbox-light', 'dracula']) +test('there are six themes and sonda comes first', () => { + expect(THEMES.map((t) => t.id)).toEqual(['sonda', 'tokyo-night', 'gruvbox-dark', 'gruvbox-light', 'dracula', 'neon']) }) test('initTheme with nothing stored uses sonda', () => { diff --git a/web/src/theme/theme.ts b/web/src/theme/theme.ts index d63060f..9f9c2d8 100644 --- a/web/src/theme/theme.ts +++ b/web/src/theme/theme.ts @@ -1,6 +1,6 @@ import { useSyncExternalStore } from 'react' -export type ThemeId = 'sonda' | 'tokyo-night' | 'gruvbox-dark' | 'gruvbox-light' | 'dracula' +export type ThemeId = 'sonda' | 'tokyo-night' | 'gruvbox-dark' | 'gruvbox-light' | 'dracula' | 'neon' export const THEMES: readonly { id: ThemeId; labelKey: string }[] = [ { id: 'sonda', labelKey: 'theme.sonda' }, @@ -8,6 +8,7 @@ export const THEMES: readonly { id: ThemeId; labelKey: string }[] = [ { id: 'gruvbox-dark', labelKey: 'theme.gruvbox-dark' }, { id: 'gruvbox-light', labelKey: 'theme.gruvbox-light' }, { id: 'dracula', labelKey: 'theme.dracula' }, + { id: 'neon', labelKey: 'theme.neon' }, ] const KEY = 'sonda.theme' diff --git a/web/src/theme/themes.css b/web/src/theme/themes.css index 04c5334..104bf5b 100644 --- a/web/src/theme/themes.css +++ b/web/src/theme/themes.css @@ -1,5 +1,5 @@ /* - * The five themes. Every colour is a plain hex value so that contrast.test.ts can check it. + * The six themes. Every colour is a plain hex value so that contrast.test.ts can check it. * Token names are the ones shadcn/ui uses. * --border is a quiet divider; --input is the outline of a form control and has to be seen (3:1). */ @@ -93,6 +93,29 @@ --ring: #ff79c6; } +/* The loudest one: colour in the surfaces too. Deep indigo ground, saturated violet panels, electric yellow. */ +[data-theme="neon"] { + color-scheme: dark; + --background: #14073d; + --foreground: #fff4ff; + --card: #2a1070; + --card-foreground: #fff4ff; + --popover: #2a1070; + --popover-foreground: #fff4ff; + --primary: #ffd23f; + --primary-foreground: #14073d; + --secondary: #4a22b0; + --secondary-foreground: #fff4ff; + --muted: #4a22b0; + --muted-foreground: #d4c2ff; + --accent: #5a2fd0; + --accent-foreground: #fff4ff; + --destructive: #ff6b81; + --border: #4a22b0; + --input: #9b85ff; + --ring: #ffd23f; +} + [data-theme="gruvbox-light"] { color-scheme: light; --background: #fbf1c7;