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:
agent 2026-11-06 19:55:42 +00:00
parent da35509ecd
commit 769b76857a
8 changed files with 103 additions and 73 deletions

31
SPEC.md
View file

@ -454,19 +454,26 @@ which group ids exist.
### 10.4 Theme ### 10.4 Theme
Dark and light, following the system setting by default with a manual Three themes, chosen per device in app settings: **System** (default:
override. Starting palette (to be validated for WCAG AA contrast): follows the OS between soft dark and light), **Dark** (soft near-black),
**Black** (true black, for OLED screens) and **Light**. Neutral backgrounds;
green is the accent only. Tokens live in `apps/web/src/app.css`:
| Token | Dark | Light | | Token | Dark | Black | Light |
|---|---|---| |---|---|---|---|
| background | `#0B2E22` | `#F2F7F4` | | background | `#0A0B0D` | `#000000` | `#F2F3F5` |
| surface | `#123D2E` | `#FFFFFF` | | surface | `#16181C` | `#121316` | `#FFFFFF` |
| surface-raised | `#1A4D3A` | `#E4EFE9` | | surface-raised | `#1F2227` | `#1B1D21` | `#E9EBEE` |
| text | `#E8F3EC` | `#0B2E22` | | text | `#F5F6F7` | same as Dark | `#0D0F12` |
| text-muted | `#9FBFAE` | `#4A6B5B` | | text-muted | `#8B9099` | same as Dark | `#5F6670` |
| accent / you are owed | `#3DDC97` | `#16865A` | | accent / you are owed | `#3DDC97` | same as Dark | `#0B7549` |
| you owe | `#F2A65A` | `#B5541C` | | you owe | `#FF9466` | same as Dark | `#B53C0A` |
| highlight (sparingly) | `#D4AF37` | `#9A7B12` | | highlight (sparingly) | `#D4AF37` | same as Dark | `#9A7B12` |
Text, muted, accent, owe and danger colours have at least 4.5:1 contrast on
every background and surface in each theme. Cards and lists are separated by
shade with hairline dividers; controls are pill-shaped; the phone tab bar
floats as a pill above the content.
Positive/negative amounts also differ by sign and icon, never by colour alone. Positive/negative amounts also differ by sign and icon, never by colour alone.

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="#0B2E22" /> <meta name="theme-color" content="#0a0b0d" />
<meta name="referrer" content="no-referrer" /> <meta name="referrer" content="no-referrer" />
<meta name="description" content="Split group expenses, end-to-end encrypted." /> <meta name="description" content="Split group expenses, end-to-end encrypted." />
<title>OweMe</title> <title>OweMe</title>

View file

@ -5,8 +5,8 @@
"start_url": "/", "start_url": "/",
"scope": "/", "scope": "/",
"display": "standalone", "display": "standalone",
"background_color": "#0B2E22", "background_color": "#0a0b0d",
"theme_color": "#0B2E22", "theme_color": "#0a0b0d",
"icons": [ "icons": [
{ "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml" }, { "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml" },
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" }, { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },

View file

@ -1,59 +1,71 @@
/* OweMe theme: dark & light "money green" (SPEC.md §10.4). */ /* OweMe theme (SPEC.md §10.4): soft dark (default), black and light.
"System" follows the OS between soft dark and light; black is opt-in.
Contrast of text, muted, accent, owe and danger against bg, surface and
surface-2 is ≥ 4.5:1 in every theme. */
:root { :root {
--bg: #0b2e22; --bg: #0a0b0d;
--surface: #123d2e; --surface: #16181c;
--surface-2: #1a4d3a; --surface-2: #1f2227;
--border: #255c46; --border: #3a3e45; /* controls: inputs, buttons */
--text: #e8f3ec; --line: #ffffff0f; /* quiet dividers: cards, lists */
--muted: #9fbfae; --text: #f5f6f7;
--muted: #8b9099;
--accent: #3ddc97; --accent: #3ddc97;
--accent-ink: #062016; --accent-ink: #04140d;
--owe: #f2a65a; --owe: #ff9466;
--danger: #f87171; --danger: #f87171;
--gold: #d4af37; --gold: #d4af37;
/* chart series, validated for CVD separation on --surface */ /* chart series, validated for CVD separation on --surface */
--chart-1: #22a66e; --chart-1: #22a66e;
--chart-2: #4a8fd0; --chart-2: #4a8fd0;
--shadow: 0 8px 30px rgb(0 0 0 / 0.35); --shadow: 0 10px 30px rgb(0 0 0 / 0.45);
--radius: 14px; --radius: 20px;
--gutter: 16px; --gutter: 16px;
color-scheme: dark; color-scheme: dark;
} }
:root[data-theme='black'] {
--bg: #000000;
--surface: #121316;
--surface-2: #1b1d21;
--border: #363a40;
}
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
:root:not([data-theme='dark']) { :root:not([data-theme]) {
--bg: #f2f7f4; --bg: #f2f3f5;
--surface: #ffffff; --surface: #ffffff;
--surface-2: #e4efe9; --surface-2: #e9ebee;
--border: #cfe0d6; --border: #c9cdd3;
--text: #0b2e22; --line: #0000000f;
--muted: #4a6b5b; --text: #0d0f12;
--accent: #16865a; --muted: #5f6670;
--accent: #0b7549;
--accent-ink: #ffffff; --accent-ink: #ffffff;
--owe: #b5541c; --owe: #b53c0a;
--danger: #c0392b; --danger: #c0392b;
--gold: #9a7b12; --gold: #9a7b12;
--chart-1: #16865a; --chart-1: #16865a;
--chart-2: #2f6fb0; --chart-2: #2f6fb0;
--shadow: 0 8px 30px rgb(11 46 34 / 0.12); --shadow: 0 8px 24px rgb(13 15 18 / 0.08);
color-scheme: light; color-scheme: light;
} }
} }
:root[data-theme='light'] { :root[data-theme='light'] {
--bg: #f2f7f4; --bg: #f2f3f5;
--surface: #ffffff; --surface: #ffffff;
--surface-2: #e4efe9; --surface-2: #e9ebee;
--border: #cfe0d6; --border: #c9cdd3;
--text: #0b2e22; --line: #0000000f;
--muted: #4a6b5b; --text: #0d0f12;
--accent: #16865a; --muted: #5f6670;
--accent: #0b7549;
--accent-ink: #ffffff; --accent-ink: #ffffff;
--owe: #b5541c; --owe: #b53c0a;
--danger: #c0392b; --danger: #c0392b;
--gold: #9a7b12; --gold: #9a7b12;
--chart-1: #16865a; --chart-1: #16865a;
--chart-2: #2f6fb0; --chart-2: #2f6fb0;
--shadow: 0 8px 30px rgb(11 46 34 / 0.12); --shadow: 0 8px 24px rgb(13 15 18 / 0.08);
color-scheme: light; color-scheme: light;
} }
@ -101,12 +113,12 @@ p { margin: 0; }
.card { .card {
background: var(--surface); background: var(--surface);
border: 1px solid var(--border); border: 1px solid var(--line);
border-radius: var(--radius); border-radius: var(--radius);
padding: 14px 16px; padding: 14px 16px;
} }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; } .list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--border); } .list > * + * { border-top: 1px solid var(--line); }
.item { .item {
display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%;
background: none; border: 0; color: inherit; font: inherit; text-align: left; text-decoration: none; background: none; border: 0; color: inherit; font: inherit; text-align: left; text-decoration: none;
@ -124,7 +136,7 @@ button, .btn {
} }
.btn { .btn {
display: inline-flex; align-items: center; justify-content: center; gap: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
min-height: 44px; padding: 0 16px; border-radius: 12px; min-height: 44px; padding: 0 18px; border-radius: 999px;
border: 1px solid var(--border); background: var(--surface); color: var(--text); border: 1px solid var(--border); background: var(--surface); color: var(--text);
font-weight: 600; text-decoration: none; white-space: nowrap; font-weight: 600; text-decoration: none; white-space: nowrap;
} }
@ -133,19 +145,19 @@ button, .btn {
.btn.primary:hover { filter: brightness(1.08); } .btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); } .btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; } .btn.small { min-height: 34px; padding: 0 14px; font-size: 0.9rem; }
.btn.block { width: 100%; } .btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; } .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { .icon-btn {
display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0;
border-radius: 12px; border: 0; background: transparent; color: var(--text); border-radius: 50%; border: 0; background: transparent; color: var(--text);
} }
.icon-btn:hover { background: var(--surface-2); } .icon-btn:hover { background: var(--surface-2); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); } label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
input, select, textarea { input, select, textarea {
font: inherit; color: var(--text); background: var(--surface); width: 100%; font: inherit; color: var(--text); background: var(--surface); width: 100%;
border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-height: 44px;
} }
textarea { min-height: 80px; resize: vertical; } textarea { min-height: 80px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .item:focus-visible, .chip:focus-visible { input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .item:focus-visible, .chip:focus-visible {
@ -154,16 +166,16 @@ input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-vi
input[type='checkbox'] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; } input[type='checkbox'] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; }
input[type='date'] { min-width: 0; } input[type='date'] { min-width: 0; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; } .seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 3px; }
.seg button { .seg button {
flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding: 0 8px; flex: 1; min-height: 38px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; padding: 0 8px;
} }
.seg button[aria-pressed='true'] { background: var(--surface-2); color: var(--text); } .seg button[aria-pressed='true'] { background: var(--surface-2); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; } .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { .chip {
display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 0.9rem;
} }
.chip[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); } .chip[aria-pressed='true'] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
@ -174,34 +186,37 @@ input[type='date'] { min-width: 0; }
} }
.cat-icon { .cat-icon {
display: inline-grid; place-items: center; flex-shrink: 0; display: inline-grid; place-items: center; flex-shrink: 0;
width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); font-size: 1.2rem; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); font-size: 1.2rem;
} }
.banner { padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--border); } .banner { padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; background: var(--surface-2); border: 1px solid var(--line); }
.banner.warn { border-color: color-mix(in srgb, var(--owe) 60%, var(--border)); } .banner.warn { border-color: color-mix(in srgb, var(--owe) 60%, var(--border)); }
.banner.danger { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); } .banner.danger { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); }
.fab { .fab {
position: fixed; right: max(var(--gutter), calc(50% - 360px + var(--gutter))); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 30; position: fixed; right: max(var(--gutter), calc(50% - 360px + var(--gutter))); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30;
width: 60px; height: 60px; border-radius: 20px; border: 0; width: 60px; height: 60px; border-radius: 50%; border: 0;
background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow);
display: grid; place-items: center; display: grid; place-items: center;
} }
/* floating pill tab bar */
.tabbar { .tabbar {
position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; position: fixed; z-index: 25;
display: flex; justify-content: center; left: var(--gutter); right: var(--gutter); bottom: calc(12px + env(safe-area-inset-bottom));
background: color-mix(in srgb, var(--surface) 94%, transparent); max-width: 560px; margin: 0 auto;
backdrop-filter: blur(10px); display: flex; justify-content: center; padding: 5px; border-radius: 999px;
-webkit-backdrop-filter: blur(10px); background: color-mix(in srgb, var(--surface-2) 90%, transparent);
border-top: 1px solid var(--border); backdrop-filter: blur(16px);
padding-bottom: env(safe-area-inset-bottom); -webkit-backdrop-filter: blur(16px);
border: 1px solid var(--line);
box-shadow: var(--shadow);
} }
.tabbar a { .tabbar a {
flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 999px;
padding: 8px 4px; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; padding: 7px 4px; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600;
} }
.tabbar a[aria-current='page'] { color: var(--accent); } .tabbar a[aria-current='page'] { color: var(--text); background: var(--surface); }
/* dialogs: full-screen sheet on phones, centered on desktop */ /* dialogs: full-screen sheet on phones, centered on desktop */
dialog.sheet { dialog.sheet {
@ -212,7 +227,7 @@ dialog.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
@media (min-width: 760px) { @media (min-width: 760px) {
dialog.sheet { dialog.sheet {
width: min(640px, calc(100% - 48px)); height: auto; max-height: calc(100dvh - 64px); width: min(640px, calc(100% - 48px)); height: auto; max-height: calc(100dvh - 64px);
margin: auto; border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); margin: auto; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow);
} }
} }
.sheet-body { padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom)); } .sheet-body { padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom)); }
@ -233,7 +248,7 @@ dialog.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
/* desktop: group page with a side column */ /* desktop: group page with a side column */
@media (min-width: 960px) { @media (min-width: 960px) {
.tabbar { position: static; justify-content: flex-start; gap: 4px; background: none; border: 0; backdrop-filter: none; padding: 0; } .tabbar { position: static; justify-content: flex-start; gap: 4px; background: none; border: 0; box-shadow: none; backdrop-filter: none; padding: 0; margin: 0; max-width: none; }
.tabbar a { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: 0.95rem; padding: 10px 14px; border-radius: 10px; } .tabbar a { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: 0.95rem; padding: 10px 14px; border-radius: 10px; }
.tabbar a[aria-current='page'] { background: var(--surface); } .tabbar a[aria-current='page'] { background: var(--surface); }
.fab { bottom: 32px; right: max(32px, calc(50% - 560px + 32px)); } .fab { bottom: 32px; right: max(32px, calc(50% - 560px + 32px)); }

View file

@ -23,6 +23,7 @@
<div class="seg" role="group" aria-label={t('theme')}> <div class="seg" role="group" aria-label={t('theme')}>
<button aria-pressed={settings.themePref === 'system'} onclick={() => settings.setTheme('system')}>{t('theme_system')}</button> <button aria-pressed={settings.themePref === 'system'} onclick={() => settings.setTheme('system')}>{t('theme_system')}</button>
<button aria-pressed={settings.themePref === 'dark'} onclick={() => settings.setTheme('dark')}>{t('theme_dark')}</button> <button aria-pressed={settings.themePref === 'dark'} onclick={() => settings.setTheme('dark')}>{t('theme_dark')}</button>
<button aria-pressed={settings.themePref === 'black'} onclick={() => settings.setTheme('black')}>{t('theme_black')}</button>
<button aria-pressed={settings.themePref === 'light'} onclick={() => settings.setTheme('light')}>{t('theme_light')}</button> <button aria-pressed={settings.themePref === 'light'} onclick={() => settings.setTheme('light')}>{t('theme_light')}</button>
</div> </div>
</div> </div>

View file

@ -26,6 +26,7 @@ const cs: Messages = {
theme: 'Vzhled', theme: 'Vzhled',
theme_system: 'Podle systému', theme_system: 'Podle systému',
theme_dark: 'Tmavý', theme_dark: 'Tmavý',
theme_black: 'Černý',
theme_light: 'Světlý', theme_light: 'Světlý',
create_group: 'Vytvořit skupinu', create_group: 'Vytvořit skupinu',

View file

@ -28,6 +28,7 @@ const en = {
theme: 'Theme', theme: 'Theme',
theme_system: 'System', theme_system: 'System',
theme_dark: 'Dark', theme_dark: 'Dark',
theme_black: 'Black',
theme_light: 'Light', theme_light: 'Light',
// new group // new group

View file

@ -4,7 +4,10 @@ import { detectLang, localeOf, translate, type Lang, type MsgKey } from './i18n.
import { kvSet } from './idb.ts'; import { kvSet } from './idb.ts';
type LangPref = 'auto' | Lang; 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 { function load<T extends string>(key: string, allowed: readonly T[], def: T): T {
try { try {
@ -22,7 +25,7 @@ function save(key: string, v: string) {
class Settings { class Settings {
langPref = $state<LangPref>(load('oweme.lang', ['auto', 'en', 'cs'], 'auto')); 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); lang = $derived<Lang>(this.langPref === 'auto' ? detectLang() : this.langPref);
locale = $derived(localeOf(this.lang)); locale = $derived(localeOf(this.lang));
@ -45,8 +48,10 @@ class Settings {
const root = document.documentElement; const root = document.documentElement;
if (this.themePref === 'system') delete root.dataset.theme; if (this.themePref === 'system') delete root.dataset.theme;
else root.dataset.theme = this.themePref; else root.dataset.theme = this.themePref;
const dark = this.themePref === 'dark' || (this.themePref === 'system' && matchMedia('(prefers-color-scheme: dark)').matches); // "System" follows the OS between soft dark and light.
document.querySelector('meta[name=theme-color]')?.setAttribute('content', dark ? '#0B2E22' : '#F2F7F4'); 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]);
} }
} }