Neutral dark, black and light themes with a modern look
Replace the green-tinted palette with neutral near-black (Dark), true black (Black, new, opt-in) and light grey (Light); green is the accent only. System (default) follows the OS between Dark and Light. All text colours keep >= 4.5:1 contrast on every surface. Stylesheet-only restyle to match the approved mock: hairline card borders (--line, separate from control --border), 20px corners, pill buttons and segmented controls, round icon buttons and FAB, floating pill tab bar. Browser theme-color follows the effective theme. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HA82gVKYyo9BHLHPW4qr4x
This commit is contained in:
parent
da35509ecd
commit
769b76857a
8 changed files with 103 additions and 73 deletions
|
|
@ -26,6 +26,7 @@ const cs: Messages = {
|
|||
theme: 'Vzhled',
|
||||
theme_system: 'Podle systému',
|
||||
theme_dark: 'Tmavý',
|
||||
theme_black: 'Černý',
|
||||
theme_light: 'Světlý',
|
||||
|
||||
create_group: 'Vytvořit skupinu',
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ const en = {
|
|||
theme: 'Theme',
|
||||
theme_system: 'System',
|
||||
theme_dark: 'Dark',
|
||||
theme_black: 'Black',
|
||||
theme_light: 'Light',
|
||||
|
||||
// new group
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ import { detectLang, localeOf, translate, type Lang, type MsgKey } from './i18n.
|
|||
import { kvSet } from './idb.ts';
|
||||
|
||||
type LangPref = 'auto' | Lang;
|
||||
type ThemePref = 'system' | 'dark' | 'light';
|
||||
type ThemePref = 'system' | 'dark' | 'black' | 'light';
|
||||
|
||||
/** Browser/OS chrome colour per theme; matches --bg in app.css. */
|
||||
const THEME_COLOR = { dark: '#0a0b0d', black: '#000000', light: '#f2f3f5' } as const;
|
||||
|
||||
function load<T extends string>(key: string, allowed: readonly T[], def: T): T {
|
||||
try {
|
||||
|
|
@ -22,7 +25,7 @@ function save(key: string, v: string) {
|
|||
|
||||
class Settings {
|
||||
langPref = $state<LangPref>(load('oweme.lang', ['auto', 'en', 'cs'], 'auto'));
|
||||
themePref = $state<ThemePref>(load('oweme.theme', ['system', 'dark', 'light'], 'system'));
|
||||
themePref = $state<ThemePref>(load('oweme.theme', ['system', 'dark', 'black', 'light'], 'system'));
|
||||
|
||||
lang = $derived<Lang>(this.langPref === 'auto' ? detectLang() : this.langPref);
|
||||
locale = $derived(localeOf(this.lang));
|
||||
|
|
@ -45,8 +48,10 @@ class Settings {
|
|||
const root = document.documentElement;
|
||||
if (this.themePref === 'system') delete root.dataset.theme;
|
||||
else root.dataset.theme = this.themePref;
|
||||
const dark = this.themePref === 'dark' || (this.themePref === 'system' && matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
document.querySelector('meta[name=theme-color]')?.setAttribute('content', dark ? '#0B2E22' : '#F2F7F4');
|
||||
// "System" follows the OS between soft dark and light.
|
||||
const effective = this.themePref !== 'system' ? this.themePref
|
||||
: matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
||||
document.querySelector('meta[name=theme-color]')?.setAttribute('content', THEME_COLOR[effective]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue