diff --git a/README.md b/README.md index 329d693..c67aa41 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 four themes (Sonda, Tokyo Night, Gruvbox dark and Gruvbox light) 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 five themes (Sonda, Tokyo Night, Gruvbox dark, Gruvbox light and Dracula) 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 2006fa4..6705983 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -116,7 +116,8 @@ "sonda": "Sonda", "tokyo-night": "Tokyo Night", "gruvbox-dark": "Gruvbox dark", - "gruvbox-light": "Gruvbox light" + "gruvbox-light": "Gruvbox light", + "dracula": "Dracula" }, "lang": { "en": "English", diff --git a/web/src/i18n/locales/it.json b/web/src/i18n/locales/it.json index 3967622..c7a8d05 100644 --- a/web/src/i18n/locales/it.json +++ b/web/src/i18n/locales/it.json @@ -116,7 +116,8 @@ "sonda": "Sonda", "tokyo-night": "Tokyo Night", "gruvbox-dark": "Gruvbox scuro", - "gruvbox-light": "Gruvbox chiaro" + "gruvbox-light": "Gruvbox chiaro", + "dracula": "Dracula" }, "lang": { "en": "English", diff --git a/web/src/index.css b/web/src/index.css index 16d5834..98b89db 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"] *)); +@custom-variant dark (&:is([data-theme="sonda"] *, [data-theme="tokyo-night"] *, [data-theme="gruvbox-dark"] *, [data-theme="dracula"] *)); @theme inline { --font-heading: var(--font-sans); diff --git a/web/src/pages/SettingsPage.test.tsx b/web/src/pages/SettingsPage.test.tsx index aa9d16f..ae277e8 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 four themes can be chosen and the current one is selected', async () => { +test('all five 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']) { + for (const name of ['Sonda', 'Tokyo Night', 'Gruvbox dark', 'Gruvbox light', 'Dracula']) { 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 89306ce..d0a7cc5 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 four themes and sonda comes first', () => { - expect(THEMES.map((t) => t.id)).toEqual(['sonda', 'tokyo-night', 'gruvbox-dark', 'gruvbox-light']) +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('initTheme with nothing stored uses sonda', () => { diff --git a/web/src/theme/theme.ts b/web/src/theme/theme.ts index 8e406c6..d63060f 100644 --- a/web/src/theme/theme.ts +++ b/web/src/theme/theme.ts @@ -1,12 +1,13 @@ import { useSyncExternalStore } from 'react' -export type ThemeId = 'sonda' | 'tokyo-night' | 'gruvbox-dark' | 'gruvbox-light' +export type ThemeId = 'sonda' | 'tokyo-night' | 'gruvbox-dark' | 'gruvbox-light' | 'dracula' export const THEMES: readonly { id: ThemeId; labelKey: string }[] = [ { id: 'sonda', labelKey: 'theme.sonda' }, { id: 'tokyo-night', labelKey: 'theme.tokyo-night' }, { id: 'gruvbox-dark', labelKey: 'theme.gruvbox-dark' }, { id: 'gruvbox-light', labelKey: 'theme.gruvbox-light' }, + { id: 'dracula', labelKey: 'theme.dracula' }, ] const KEY = 'sonda.theme' diff --git a/web/src/theme/themes.css b/web/src/theme/themes.css index 2f1f2af..04c5334 100644 --- a/web/src/theme/themes.css +++ b/web/src/theme/themes.css @@ -1,5 +1,5 @@ /* - * The four themes. Every colour is a plain hex value so that contrast.test.ts can check it. + * The five 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). */ @@ -70,6 +70,29 @@ --ring: #fabd2f; } +/* The lively one: Dracula's violet ground with a hot pink accent. */ +[data-theme="dracula"] { + color-scheme: dark; + --background: #282a36; + --foreground: #f8f8f2; + --card: #343746; + --card-foreground: #f8f8f2; + --popover: #343746; + --popover-foreground: #f8f8f2; + --primary: #ff79c6; + --primary-foreground: #282a36; + --secondary: #44475a; + --secondary-foreground: #f8f8f2; + --muted: #44475a; + --muted-foreground: #b4b8d4; + --accent: #44475a; + --accent-foreground: #f8f8f2; + --destructive: #ff5555; + --border: #44475a; + --input: #7081b8; + --ring: #ff79c6; +} + [data-theme="gruvbox-light"] { color-scheme: light; --background: #fbf1c7;