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
This commit is contained in:
parent
0d5805fd37
commit
241c1efc5d
8 changed files with 36 additions and 10 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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', () => {
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue