From 90ad90646a8d4eef3e984ade3df6d5d5b6f935ca Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 14 Nov 2026 13:55:14 +0800 Subject: [PATCH] gui: black draws a black dark theme, not Graphite's grey (CHENGJIAHEGOXIS on X) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CHENGJIAHEGOXIS, on v0.1.4124 (tweet 2121468612238266666), with three dark-theme screenshots of Settings > General, one each with Default, Graphite and a custom black picked: 「这三个颜色……都显示是一样的」, 「尤其是黑色始终一直是灰色」. Their screenshots show the same page in all three: ground (25,25,27), card (32,32,34). Why: - v0.1.4124 tints the grounds with the pick's hue only (base + k*(c - mean(c))), lightness kept. Black and Graphite have no hue, so they changed nothing. Default draws no look at all (magpie's own). - accentOn lifts a dark pick toward white only until it reads at 4.5:1, so black's dark ink came out #8a8a8a, next to Graphite's #89898f. What changes (appearance.go): - ground(): on the dark theme, a pick darker than the theme's background darkens every dark ground by as much (depth()). Black draws a black page (#000003), with cards, pills, lines, menus and the tray panel the same steps above it as in app.css (card #08080c, line #18181e). Graphite, and any colour as light as the ground, draw as before. - lifted(): black's ink starts most of the way to white, so it is a light mono ink (#e0e0e0, dark text on its buttons), not Graphite's grey. On the light theme black is #000000, as before. The sibling, white on the light theme, now gets a dark ink instead of a mid grey. - The light theme's grounds keep their lightness: a white pick would melt its white cards into the page. - app.css: a swatch's edge and the chosen ring take a little of the text's ink, so the black swatch stays seen on the black page it draws. - Default stays magpie's own look (grey grounds, indigo accent) for every user. Not changed here. Tests: - TestBlackIsBlack: black's dark page is black and each ground keeps its step; Graphite moves nothing; black's ink is light in dark (>= 1.8:1 from Graphite's) and #000000 in light; white's light ink is dark; text reads >= 7:1 on black's grounds. - appearance-look.test.cjs: "Default, Graphite and black are three looks", light and dark, both engines: three different --accent values; Graphite keeps the grey page; in dark, black's page is black, Settings' list sits on black's card a step above it, its ink is light; in light, black is #000000 ink. - TestLookFixture's fixture gains #000000 and #52525b. Run on mote (mote was unreachable for ~20 minutes; the red check ran on mica), at this commit rebased on origin/main fc896a9f6: - gofmt -l internal/gui: clean. go vet -tags nogui ./internal/gui, the same with GOOS=linux, and GOOS=windows go vet ./internal/gui: ok (before the rebase onto fc896a9f6, which touched nothing in gui). - go test -tags nogui -timeout 45m ./internal/gui: ok (95s, before the rebase); at the rebased head go test -run 'TestAccent|TestLook|TestTint|TestWallpaper|TestBlack|Budget': ok. - node --test, both engines (the files run every language at 420 and 1000px where they have that matrix): appearance-look 44/44, i18n-keys 4/4 at the rebased head; checkbox-look 8/8, seg-contrast 14/14, settings-general 20/20, settings-sections 10/10, input-look 20/20 before the rebase. api-key-theme 0/6 (#6444) and omarchy 8/14 (#6027) are red with the same cases on a copy of origin/main fc896a9f6. - Broken by hand: with origin/main's appearance.go and its fixture regenerated for #000000 and #52525b, the new GUI case is red in dark in both engines ("black's page is black, not rgb(26, 26, 30)"); light passes there, as black was already #000000 ink on the light theme. - Screenshots, both engines, Settings > General zh at 1200, Default / Graphite / black, light and dark, before (origin/main's lookCSS) and after (before shots on mica, after on mote): dark black's page goes (26,26,30) -> (0,0,3), card (35,35,39) -> (8,8,12); Default and Graphite unchanged; black's ring still shows. Not tried: - the real macOS app, WebView2 and WebKitGTK; - the full Go and GUI suites. --- docs/subsystems/gui-shell.md | 2 +- internal/gui/appearance.go | 76 +++++++++++++++---- internal/gui/appearance_test.go | 72 ++++++++++++++++-- internal/gui/assets/app.css | 8 +- internal/gui/tests/appearance-look.test.cjs | 45 +++++++++++ internal/gui/tests/fixtures/look-accents.json | 8 +- 6 files changed, 185 insertions(+), 26 deletions(-) diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index 21c497fc8..d36a182ca 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -31,7 +31,7 @@ three. 1. `magpie` with no arguments, `magpie app` or `magpie tray` calls `runGUI`, which starts the app's log (`startLog`, above) and calls `gui.Run`. A `nogui` build runs the TUI instead. A second launch hands over to the instance already running. On Windows, before any window is made, `webView2Check` asks Wails whether the WebView2 runtime is there (`Env.Info().PlatformInfo["WebView2"]`, "" when its lookup fails; a key Wails doesn't set counts as there). Without it Wails would exit on the first window with nothing on screen, so magpie logs it, shows a Windows message box in the reader's language naming the runtime, Microsoft's download page (`webView2Page`) and `magpie web` / `magpie tui`, opens the page on Yes, and `Run` ends (#1806, `webview2.go`, `TestWebView2MissingFromWails` on Windows). The box can't come from `ErrorHandler`, which runs on the thread Wails makes its windows on. 2. `startBackend` brings up the gateway, or finds another magpie serving it. -3. The panel and the window load `index.html` from `Handler`. `boot.js` passes the saved language, theme, colorblind mode, text size and desktop font choices before the first paint. It also puts in the look of the reader's own (`appearance.go`, CHENGJIAHEGOXIS on X): Settings › General's Accent color (`accent`, `#rrggbb`; `accentVars` darkens it on the light theme and lightens it on the dark one until it reads as text at 4.5:1; it also sets `--mark`, the ink of what is chosen: the open page's sidebar icon, a switch's or tab's chosen option, Library's switches and radios. `--mark` is `var(--fg)`, graphite, until the user picks an accent, so a picked colour shows on the page it is picked on. A picked colour also tints the theme's grounds, the window's and the tray panel's (`--bg`, `--card`, the pills, lines and the dark menus' `--pop-bg`; `tintVars`): each takes 5% (light) or 8% (dark) of the colour's hue, its own lightness kept, so a grey pick changes nothing and text keeps its contrast; with no accent, or under Omarchy, they are app.css's own. `TestTintBasesAreAppCSS` holds the Go bases to app.css, and `TestLookFixture` the GUI tests' `fixtures/look-accents.json` to `lookCSS`) and Background image (a PNG, JPEG, GIF or WebP of 16 MB at most, saved as `wallpaper` in magpie's folder by `POST /api/appearance/wallpaper` as base64 JSON, `{remove: true}` to take it away; `settings.Wallpaper` is its stamp), drawn behind the window's pages under a veil of the theme's background, never in the tray panel or under Omarchy. `bootPrefs.look` says which look was drawn; `applyPrefs` asks `/api/appearance/css` again only when the settings' look differs, and the rows are drawn by the lazy `appearance.js` (`appearance-look.test.cjs`, `appearance_test.go`). +3. The panel and the window load `index.html` from `Handler`. `boot.js` passes the saved language, theme, colorblind mode, text size and desktop font choices before the first paint. It also puts in the look of the reader's own (`appearance.go`, CHENGJIAHEGOXIS on X): Settings › General's Accent color (`accent`, `#rrggbb`; `accentVars` darkens it on the light theme and lightens it on the dark one until it reads as text at 4.5:1; it also sets `--mark`, the ink of what is chosen: the open page's sidebar icon, a switch's or tab's chosen option, Library's switches and radios. `--mark` is `var(--fg)`, graphite, until the user picks an accent, so a picked colour shows on the page it is picked on. A picked colour also tints the theme's grounds, the window's and the tray panel's (`--bg`, `--card`, the pills, lines and the dark menus' `--pop-bg`; `tintVars`): each takes 5% (light) or 8% (dark) of the colour's hue, its own lightness kept, so a grey pick changes nothing and text keeps its contrast. A pick darker than the dark theme's background darkens the dark grounds by as much (`ground`, `depth`): black draws a black page with its cards, pills, lines and menus the same steps above it, and its ink starts most of the way to white (`lifted`), so it is not Graphite's grey; on the light theme black is black ink, and white the light theme's dark ink (`TestBlackIsBlack`); with no accent, or under Omarchy, they are app.css's own. `TestTintBasesAreAppCSS` holds the Go bases to app.css, and `TestLookFixture` the GUI tests' `fixtures/look-accents.json` to `lookCSS`) and Background image (a PNG, JPEG, GIF or WebP of 16 MB at most, saved as `wallpaper` in magpie's folder by `POST /api/appearance/wallpaper` as base64 JSON, `{remove: true}` to take it away; `settings.Wallpaper` is its stamp), drawn behind the window's pages under a veil of the theme's background, never in the tray panel or under Omarchy. `bootPrefs.look` says which look was drawn; `applyPrefs` asks `/api/appearance/css` again only when the settings' look differs, and the rows are drawn by the lazy `appearance.js` (`appearance-look.test.cjs`, `appearance_test.go`). 4. The page reads `GET /api/state` and writes through `POST` routes. Each write answers with the new state, built under `held`. 5. Closing the window hides it. On the Mac a full-screen window first leaves full screen (`closeStep`). The system's close on the panel (a title bar's X, Alt+F4, a window manager's close key) hides it as Escape does, so the tray icon opens it again; a panel lightweight mode let go, no longer `h.panel`, closes (`makePanel`, `TestPanelCloseHidesIt`). A hidden macOS window keeps its WKWebView's page marked visible, so `hideWebview` tells the page it is out of sight before `orderOut`; that makes `document.hidden` and `visibilityState` true, stops the page's polling and frame loops, and pauses CSS animations. `showWebview` tells it it is visible again (#4293). Lightweight mode lets go only of a window closed this way: one covered by another app's window, minimised, or open as magpie was hidden is still open (`windowUp`, not Wails' `IsVisible`, which is the occlusion state), and so is it for the Dock while the window is open and for a restart (#1381, `TestCoveredWindowStaysUp`). On the Mac the tray icon and a usage cell close an open panel by the same test (`windowOpen` in `togglePanelNow` and `trayCellClick`, not Wails' `ToggleWindow`), so under a window over the whole screen, such as a remote-desktop server's privacy curtain, the icon still closes the panel instead of showing it again (#1661, `TestTrayCellClickReleasedPanel`). On Windows a hidden window's WebView2 is put on its low memory target (`lowWhileHidden`, [`memtarget_windows.go`](../../internal/gui/memtarget_windows.go): `ICoreWebView2_19::put_MemoryUsageTargetLevel`, on each hide, on a page that comes while hidden, and back to normal on each show), so the panel and the window kept loaded in the tray stop holding what they last drew; the page stays loaded and running, unlike lightweight mode. In the tray the WebView2 processes' private working set went from ~170 MB to 20 to 40 MB, while their commit charge stayed where it was (molamaker11 on X). WKWebView and WebKitGTK have nothing magpie can set for it. 6. The window opens as it was last left. Its settled size and whether it was maximised are kept in `settings.Window` and `settings.WindowMaximised` (`settle`; per machine, see `KeepOwn`). A maximised window keeps the size it restores to. `makeMain` opens it at that size (`openSize`). On its first show, `placeMain` maximises it again on the Mac and Windows (on Windows once the page has come). On Linux, `makeMain` makes it maximised with `StartState`. On Windows a size larger than the screen's work area is fitted and centred (`fitRoom`), and the larger size stays kept. Where it was left is kept too, in `settings.WindowAt` (its top left corner across every screen, in the system's coordinates), so after a restart or an update it opens there rather than in the middle (jorbenzhu on Discord). `keepAt` saves it once a move or resize has rested for half a second, unless the window is maximised, full screen, minimised or hidden; `settings.Save` writes through temp and rename, and a settings file that can't be read is left alone. On its first show `placeMain` puts it back (`putBack`): `openAt` takes the screen holding most of the window, moves the window fully onto that screen's work area, and leaves it centred when no screen holds any of it, such as a monitor that is gone, or when the screens or the file can't be read (`TestOpenAt`). Under Wayland a window can't place itself, so nothing is kept or put back there unless GDK_BACKEND is x11 (`keepsPlace`, `TestKeepsPlace`). The tray's panel isn't kept: on the Mac and Windows it opens under the tray icon, and on Linux where the click was. diff --git a/internal/gui/appearance.go b/internal/gui/appearance.go index 9d2d2854a..b2e4098d9 100644 --- a/internal/gui/appearance.go +++ b/internal/gui/appearance.go @@ -58,14 +58,14 @@ func lookKey(s settings.Settings) string { func lookCSS(s settings.Settings) string { var b strings.Builder if c, ok := parseHex(s.Accent); ok { - light := accentVars(c, false) + ";" + tintVars(c, lightSurfaces, lightTint) - dark := accentVars(c, true) + ";" + tintVars(c, darkSurfaces, darkTint) + ";" + popVar(c) + light := accentVars(c, false) + ";" + tintVars(c, lightSurfaces, false) + dark := accentVars(c, true) + ";" + tintVars(c, darkSurfaces, true) + ";" + popVar(c) fmt.Fprintf(&b, "html:not(.omarchy):root{%s}\n", light) fmt.Fprintf(&b, "@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){%s}}\n", dark) fmt.Fprintf(&b, "html:not(.omarchy):root[data-theme=\"dark\"]{%s}\n", dark) // the tray panel draws its surfaces on body.panel, so they are // tinted there too, the frosted panel's tint (tintPanel) with them - lightP, darkP := tintVars(c, lightPanelSurfaces, lightTint), tintVars(c, darkPanelSurfaces, darkTint) + lightP, darkP := tintVars(c, lightPanelSurfaces, false), tintVars(c, darkPanelSurfaces, true) fmt.Fprintf(&b, "@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{%s}}\n", lightP) fmt.Fprintf(&b, "html:not(.omarchy):root[data-theme=\"light\"] body.panel{%s}\n", lightP) fmt.Fprintf(&b, "@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{%s}}\n", darkP) @@ -154,9 +154,9 @@ var ( // tinted with c. func accentOn(c rgb, dark bool) rgb { if dark { - return inkOn(c, white, darkCard, tint(darkCard, c, darkTint), tint(darkBg, c, darkTint)) + return inkOn(lifted(c, true), white, darkCard, ground(darkCard, c, true), ground(darkBg, c, true)) } - return inkOn(c, black, lightBg, tint(lightBg, c, lightTint)) + return inkOn(lifted(c, false), black, lightBg, ground(lightBg, c, false)) } // inkOn is c moved toward toward just enough to read as text on each of @@ -195,11 +195,12 @@ func accentVars(c rgb, dark bool) string { } soft, sel := white.mix(a, 0.09), white.mix(a, 0.11) fill := white.mix(a, 0.12) - mark := inkOn(c, black, lightPick, tint(lightPick, c, lightTint), fill) + mark := inkOn(lifted(c, false), black, lightPick, ground(lightPick, c, false), fill) if dark { - soft, sel = darkBg.mix(a, 0.14), darkBg.mix(a, 0.2) - fill = darkFill.mix(a, 0.26) - mark = inkOn(c, white, darkPick, tint(darkPick, c, darkTint), fill) + bg := ground(darkBg, c, true) + soft, sel = bg.mix(a, 0.14), bg.mix(a, 0.2) + fill = ground(darkFill, c, true).mix(a, 0.26) + mark = inkOn(lifted(c, true), white, darkPick, ground(darkPick, c, true), fill) } return fmt.Sprintf("--accent:%s;--accent-soft:%s;--accent-fg:%s;--sel:%s;--mark:%s;--mark-fill:%s", a.hex(), soft.hex(), fg.hex(), sel.hex(), mark.hex(), fill.hex()) } @@ -239,19 +240,66 @@ func tint(base, c rgb, k float64) rgb { return out } -// tintVars are surfaces tinted with c's hue, the theme's grounds once the user picked a colour of -// their own. Without one each keeps app.css's grey. -func tintVars(c rgb, surfaces []surface, k float64) string { +// depth is how far past the dark theme's background c is toward black, +// 0 for a colour as light as it or lighter, 1 for black: a pick darker +// than the theme's own ground asks for a darker theme (CHENGJIAHEGOXIS on +// X: black, Graphite and Default drew the same grey grounds, 「尤其是黑色 +// 始终一直是灰色」). On the light theme, the same for a pick lighter than +// its background, toward white. +func depth(c rgb, dark bool) float64 { + g := (c[0] + c[1] + c[2]) / 3 + if dark { + ref := (darkBg[0] + darkBg[1] + darkBg[2]) / 3 + return max(0, ref-g) / ref + } + ref := (lightBg[0] + lightBg[1] + lightBg[2]) / 3 + return max(0, g-ref) / (255 - ref) +} + +// ground is one of the theme's grounds once c is picked: tinted with c's +// hue, and, on the dark theme, as much darker as c is darker than the +// theme's background, so black draws a black page with its cards, menus +// and lines the same steps above it. The light theme's grounds keep their +// lightness: a white pick there would melt its white cards into the page. +func ground(base, c rgb, dark bool) rgb { + if !dark { + return tint(base, c, lightTint) + } + out := tint(base, c, darkTint) + d := depth(c, true) * (darkBg[0] + darkBg[1] + darkBg[2]) / 3 + for i := range out { + out[i] = max(0, out[i]-d) + } + return out +} + +// lifted is where c's ink starts on a theme: c itself, or, for a pick +// past the theme's background (black on the dark theme, white on the +// light one), most of the way to the other end, so black reads as the +// dark theme's light ink and not as a grey that is Graphite's (and white +// as the light theme's dark ink). A colour that reads as it is starts +// as it is. +func lifted(c rgb, dark bool) rgb { + if dark { + return c.mix(white, 0.88*depth(c, true)) + } + return c.mix(black, 0.88*depth(c, false)) +} + +// tintVars are surfaces as ground draws them, the theme's grounds once +// the user picked a colour of their own. Without one each keeps app.css's +// grey. +func tintVars(c rgb, surfaces []surface, dark bool) string { parts := make([]string, 0, len(surfaces)) for _, s := range surfaces { - parts = append(parts, s.name+":"+tint(s.base, c, k).hex()) + parts = append(parts, s.name+":"+ground(s.base, c, dark).hex()) } return strings.Join(parts, ";") } // popVar is the dark theme's menu ground, tinted as its other grounds are. func popVar(c rgb) string { - p := tint(darkPop, c, darkTint) + p := ground(darkPop, c, true) return fmt.Sprintf("--pop-bg:rgba(%d,%d,%d,.96)", int(math.Round(p[0])), int(math.Round(p[1])), int(math.Round(p[2]))) } diff --git a/internal/gui/appearance_test.go b/internal/gui/appearance_test.go index 45e7517c3..eb080e976 100644 --- a/internal/gui/appearance_test.go +++ b/internal/gui/appearance_test.go @@ -6,6 +6,7 @@ import ( "image" "image/color" "image/png" + "math" "net/http" "net/http/httptest" "os" @@ -279,7 +280,7 @@ func TestAccentTintsGrounds(t *testing.T) { // a grey pick leaves the grounds as they were g, _ := parseHex("#808080") for _, s := range darkSurfaces { - if got := tint(s.base, g, darkTint); got.hex() != s.base.hex() { + if got := ground(s.base, g, true); got.hex() != s.base.hex() { t.Errorf("grey tints %s: %s", s.name, got.hex()) } } @@ -287,15 +288,15 @@ func TestAccentTintsGrounds(t *testing.T) { for _, pick := range []string{"#ffffff", "#000000", "#ffff00", "#00ff00", "#ff0000", "#0000ff", "#7c3aed", "#0d9488", "#db2777"} { c, _ := parseHex(pick) for _, dark := range []bool{false, true} { - surfaces, k, fg, accent := lightSurfaces, lightTint, rgb{0x1c, 0x1c, 0x21}, accentOn(c, false) + surfaces, fg, accent := lightSurfaces, rgb{0x1c, 0x1c, 0x21}, accentOn(c, false) if dark { - surfaces, k, fg, accent = darkSurfaces, darkTint, rgb{0xed, 0xed, 0xf1}, accentOn(c, true) + surfaces, fg, accent = darkSurfaces, rgb{0xed, 0xed, 0xf1}, accentOn(c, true) } for _, s := range surfaces { if strings.HasPrefix(s.name, "--line") || s.name == "--seg-track" { continue } - bg := tint(s.base, c, k) + bg := ground(s.base, c, dark) if r := contrast(fg, bg); r < 7 { t.Errorf("%s dark=%v: text on %s %s is %.2f:1", pick, dark, s.name, bg.hex(), r) } @@ -351,7 +352,7 @@ func TestTintBasesAreAppCSS(t *testing.T) { // writes it again. func TestLookFixture(t *testing.T) { want := map[string]string{} - for _, a := range []string{"#0d9488", "#db2777", "#7c3aed"} { + for _, a := range []string{"#0d9488", "#db2777", "#7c3aed", "#000000", "#52525b"} { want[a] = lookCSS(settings.Settings{Accent: a}) } b, _ := json.MarshalIndent(want, "", " ") @@ -367,3 +368,64 @@ func TestLookFixture(t *testing.T) { t.Fatalf("%s is not lookCSS's (UPDATE=1 go test -run TestLookFixture writes it): %v", path, err) } } + +// Black, Graphite and magpie's own drew the same grey grounds, and black's +// ink was Graphite's grey (CHENGJIAHEGOXIS on X, 「这三个颜色……都显示是一样 +// 的」, 「尤其是黑色始终一直是灰色」). Black now draws a black page on the +// dark theme, its cards, menus and lines the same steps above it, with a +// light ink of its own; on the light theme it is black ink. Graphite keeps +// the grey grounds with its grey ink, and magpie's own draws nothing. +func TestBlackIsBlack(t *testing.T) { + blk, _ := parseHex("#000000") + gra, _ := parseHex("#52525b") + accent := func(c rgb, dark bool) rgb { + m := regexp.MustCompile(`--accent:(#[0-9a-f]{6})`).FindStringSubmatch(accentVars(c, dark)) + a, _ := parseHex(m[1]) + return a + } + // the dark theme's page is black, and every ground keeps its step + // above it, in the same order as app.css's + if got := ground(darkBg, blk, true); got.luminance() > 0.002 { + t.Errorf("black's dark page is %s, not black", got.hex()) + } + for _, set := range [][]surface{darkSurfaces, darkPanelSurfaces, {{"--pop-bg", darkPop}}} { + for _, s := range set { + got := ground(s.base, blk, true) + if lb, lg := s.base.luminance(), got.luminance(); lg >= lb { + t.Errorf("%s: black leaves %s at %s", s.name, s.base.hex(), got.hex()) + } + want := (s.base[0]+s.base[1]+s.base[2])/3 - (darkBg[0]+darkBg[1]+darkBg[2])/3 + if g := (got[0] + got[1] + got[2]) / 3; math.Abs(g-max(0, want)) > 2 { + t.Errorf("%s: %s is not its step %.0f above black", s.name, got.hex(), want) + } + } + } + // Graphite (lighter than the page) keeps the grounds' grey + for _, s := range darkSurfaces { + if got := ground(s.base, gra, true); got.hex() != s.base.hex() { + t.Errorf("Graphite moves %s to %s", s.name, got.hex()) + } + } + // black's ink is not Graphite's grey: light on the dark theme, black + // on the light one, each reading on its own grounds + if a, g := accent(blk, true), accent(gra, true); contrast(a, g) < 1.8 || a.luminance() < 0.6 { + t.Errorf("dark: black's accent %s is a grey like Graphite's %s", a.hex(), g.hex()) + } + if a := accent(blk, false); a.hex() != "#000000" { + t.Errorf("light: black's accent is %s", a.hex()) + } + if r := contrast(accent(blk, true), ground(darkBg, blk, true)); r < 7 { + t.Errorf("dark: black's accent on its page is %.2f:1", r) + } + // and the light theme's sibling: white's ink is dark, not a grey + wht, _ := parseHex("#ffffff") + if a := accent(wht, false); a.luminance() > 0.03 { + t.Errorf("light: white's accent %s is a grey like Graphite's", a.hex()) + } + // the page's text reads on black's grounds + for _, s := range darkSurfaces { + if r := contrast(rgb{0xed, 0xed, 0xf1}, ground(s.base, blk, true)); r < 7 { + t.Errorf("%s: text on black's %s is %.2f:1", s.name, ground(s.base, blk, true).hex(), r) + } + } +} diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index e9db1f9f4..d40854c17 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -3259,10 +3259,12 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; } .row.pref .tray-windows .proto.pick { max-width: 100%; margin-left: 0; } .row.pref .tray-windows .proto.pick > span { overflow: hidden; text-overflow: ellipsis; } /* Accent color and Background image (appearance.js): a row of swatches, - the chosen one ringed; the last is a colour of the reader's own */ + the chosen one ringed; the last is a colour of the reader's own. The + edge and the ring take a little of the text's ink, so black stays + seen on the black page it draws (CHENGJIAHEGOXIS on X) */ .accent-pick { flex: 0 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; min-width: 0; } -.accent-pick .swatch { position: relative; flex: none; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); cursor: default; transition: box-shadow .15s ease, transform .12s var(--ease-out); } -.accent-pick .swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--sw); } +.accent-pick .swatch { position: relative; flex: none; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 14%, transparent); cursor: default; transition: box-shadow .15s ease, transform .12s var(--ease-out); } +.accent-pick .swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px color-mix(in srgb, var(--sw) 78%, var(--fg)); } .accent-pick .swatch:active { transform: scale(.92); } .accent-pick .swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; } /* not yet chosen, the own colour is an empty ring with a plus */ diff --git a/internal/gui/tests/appearance-look.test.cjs b/internal/gui/tests/appearance-look.test.cjs index ba036c129..ffab0e99b 100644 --- a/internal/gui/tests/appearance-look.test.cjs +++ b/internal/gui/tests/appearance-look.test.cjs @@ -249,6 +249,51 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", }); } + // CHENGJIAHEGOXIS on X, on v0.1.4124: 「这三个颜色……都显示是一样的」, + // 「尤其是黑色始终一直是灰色」. Default, Graphite and a black of their own + // drew the same grey page, and black's ink was Graphite's grey. Black now + // draws a black page on the dark theme with a light ink of its own, and + // black ink on the light theme; Graphite keeps the grey page. + for (const theme of ["light", "dark"]) { + test(`${engine}: ${theme}, Default, Graphite and black are three looks`, async (t) => { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + const dark = theme === "dark"; + const rgbOf = (h) => `rgb(${parseInt(h.slice(1, 3), 16)}, ${parseInt(h.slice(3, 5), 16)}, ${parseInt(h.slice(5, 7), 16)})`; + const { page, errors } = await open(browser, { theme }, 1200); + await page.waitForFunction(() => document.body.classList.contains("side-nav")); + const look = () => page.evaluate(() => { + const bg = (e) => (e ? getComputedStyle(e).backgroundColor : "missing"); + return { body: getComputedStyle(document.body).backgroundColor, list: bg(document.querySelector("#setPage-general .list.prefs")), accent: getComputedStyle(document.documentElement).getPropertyValue("--accent").trim() }; + }); + const want = (v) => varOf(v, "--accent", dark); + const own = await look(); + await page.locator('#accentPick .swatch[data-accent="#52525b"]').click(); + await page.waitForFunction((w) => getComputedStyle(document.documentElement).getPropertyValue("--accent").trim() === w, want("#52525b")); + const graphite = await look(); + await page.locator("#accentPick .swatch.own input").evaluate((i) => { i.value = "#000000"; i.dispatchEvent(new Event("change", { bubbles: true })); }); + await page.waitForFunction((w) => getComputedStyle(document.documentElement).getPropertyValue("--accent").trim() === w, want("#000000")); + const blk = await look(); + assert.deepEqual(new Set([own.accent, graphite.accent, blk.accent]).size, 3, `three inks: ${own.accent} ${graphite.accent} ${blk.accent}`); + assert.equal(graphite.body, own.body, "Graphite keeps the grey page"); + if (dark) { + assert.equal(blk.body, rgbOf(varOf("#000000", "--bg", true)), "black's page"); + const [r, g, b] = blk.body.match(/\d+/g).map(Number); + assert.ok(r + g + b <= 9, `black's page is black, not ${blk.body}`); + assert.equal(blk.list, rgbOf(varOf("#000000", "--card", true)), "Settings' list is on black's card"); + assert.notEqual(blk.list, blk.body, "the card stands a step above the page"); + // its ink is light, and the page's text reads on it + assert.ok(parseInt(blk.accent.slice(1, 3), 16) > 0xc0, `black's ink is light, not ${blk.accent}`); + } else { + assert.equal(blk.accent, "#000000", "black is black ink on the light theme"); + assert.equal(blk.body, own.body, "the light page keeps its ground"); + } + // the chosen swatch is black's own, drawn black + assert.deepEqual(await chosen(page), ["own:#000000"]); + assert.deepEqual(errors, []); + }); + } + test(`${engine}: a look boot.js drew is not asked for again`, async (t) => { const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); t.after(() => browser.close()); diff --git a/internal/gui/tests/fixtures/look-accents.json b/internal/gui/tests/fixtures/look-accents.json index a109ea007..e960ae434 100644 --- a/internal/gui/tests/fixtures/look-accents.json +++ b/internal/gui/tests/fixtures/look-accents.json @@ -1,5 +1,7 @@ { - "#0d9488": "html:not(.omarchy):root{--accent:#0b7c72;--accent-soft:#e9f3f2;--accent-fg:#ffffff;--sel:#e4f1f0;--mark:#0a766d;--mark-fill:#e2efee;--bg:#f0f6f8;--card-2:#f5fbfd;--pill:#edf3f6;--pill-hover:#e5ebf0;--seg-track:#e2e8ed;--line:#dfe5ea;--line-2:#e8eef2}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#209d92;--accent-soft:#1b2c2e;--accent-fg:#14141a;--sel:#1b3435;--mark:#8bccc6;--mark-fill:#335454;--bg:#131e21;--card:#1c272a;--card-2:#182326;--pill:#263136;--pill-hover:#2f3a40;--line:#2c373c;--line-2:#253035;--pop-bg:rgba(31,42,46,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#209d92;--accent-soft:#1b2c2e;--accent-fg:#14141a;--sel:#1b3435;--mark:#8bccc6;--mark-fill:#335454;--bg:#131e21;--card:#1c272a;--card-2:#182326;--pill:#263136;--pill-hover:#2f3a40;--line:#2c373c;--line-2:#253035;--pop-bg:rgba(31,42,46,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#eef4f7;--card-2:#f4fafc;--pill-hover:#f0f6f9;--skel:#eaf0f4;--skel-hi:#dee4ea}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#eef4f7;--card-2:#f4fafc;--pill-hover:#f0f6f9;--skel:#eaf0f4;--skel-hi:#dee4ea}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#142023;--card:#1e2a2f;--card-2:#1a262a;--pill:#273339;--pill-hover:#313d45}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#142023;--card:#1e2a2f;--card-2:#1a262a;--pill:#273339;--pill-hover:#313d45}\n", - "#7c3aed": "html:not(.omarchy):root{--accent:#7c3aed;--accent-soft:#f3edfd;--accent-fg:#ffffff;--sel:#f1e9fd;--mark:#7c3aed;--mark-fill:#efe7fd;--bg:#f3f0fb;--card-2:#f8f5ff;--pill:#f0edf9;--pill-hover:#e8e5f3;--seg-track:#e5e2f0;--line:#e2dfed;--line-2:#ebe8f5}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#a171f2;--accent-soft:#2d263c;--accent-fg:#14141a;--sel:#352b48;--mark:#cdb4f8;--mark-fill:#55486e;--bg:#191326;--card:#221c2f;--card-2:#1e182b;--pill:#2c263b;--pill-hover:#352f45;--line:#322c41;--line-2:#2b253a;--pop-bg:rgba(37,31,51,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#a171f2;--accent-soft:#2d263c;--accent-fg:#14141a;--sel:#352b48;--mark:#cdb4f8;--mark-fill:#55486e;--bg:#191326;--card:#221c2f;--card-2:#1e182b;--pill:#2c263b;--pill-hover:#352f45;--line:#322c41;--line-2:#2b253a;--pop-bg:rgba(37,31,51,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#f1eefa;--card-2:#f7f4ff;--pill-hover:#f3f0fc;--skel:#edeaf7;--skel-hi:#e1deed}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#f1eefa;--card-2:#f7f4ff;--pill-hover:#f3f0fc;--skel:#edeaf7;--skel-hi:#e1deed}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#1a1528;--card:#241f34;--card-2:#201b2f;--pill:#2d283e;--pill-hover:#37324a}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#1a1528;--card:#241f34;--card-2:#201b2f;--pill:#2d283e;--pill-hover:#37324a}\n", - "#db2777": "html:not(.omarchy):root{--accent:#ce2570;--accent-soft:#fbebf2;--accent-fg:#ffffff;--sel:#fae7ef;--mark:#c12269;--mark-fill:#f9e5ee;--bg:#f9f0f6;--card-2:#fef5fb;--pill:#f6edf4;--pill-hover:#eee5ee;--seg-track:#ebe2eb;--line:#e8dfe8;--line-2:#f1e8f0}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#e35795;--accent-soft:#36222f;--accent-fg:#14141a;--sel:#422636;--mark:#f1a9c9;--mark-fill:#664155;--bg:#21131d;--card:#2a1c26;--card-2:#261822;--pill:#342632;--pill-hover:#3d2f3c;--line:#3a2c38;--line-2:#332531;--pop-bg:rgba(45,31,42,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#e35795;--accent-soft:#36222f;--accent-fg:#14141a;--sel:#422636;--mark:#f1a9c9;--mark-fill:#664155;--bg:#21131d;--card:#2a1c26;--card-2:#261822;--pill:#342632;--pill-hover:#3d2f3c;--line:#3a2c38;--line-2:#332531;--pop-bg:rgba(45,31,42,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#f7eef5;--card-2:#fdf4fa;--pill-hover:#f9f0f7;--skel:#f3eaf2;--skel-hi:#e7dee8}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#f7eef5;--card-2:#fdf4fa;--pill-hover:#f9f0f7;--skel:#f3eaf2;--skel-hi:#e7dee8}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#22151f;--card:#2c1f2b;--card-2:#281b26;--pill:#352835;--pill-hover:#3f3241}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#22151f;--card:#2c1f2b;--card-2:#281b26;--pill:#352835;--pill-hover:#3f3241}\n" + "#000000": "html:not(.omarchy):root{--accent:#000000;--accent-soft:#e8e8e8;--accent-fg:#ffffff;--sel:#e3e3e3;--mark:#000000;--mark-fill:#e0e0e0;--bg:#f4f4f6;--card-2:#f9f9fb;--pill:#f1f1f4;--pill-hover:#e9e9ee;--seg-track:#e6e6eb;--line:#e3e3e8;--line-2:#ececf0}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#e0e0e0;--accent-soft:#1f1f22;--accent-fg:#14141a;--sel:#2d2d2f;--mark:#e0e0e0;--mark-fill:#515155;--bg:#000003;--card:#08080c;--card-2:#040408;--pill:#121218;--pill-hover:#1b1b22;--line:#18181e;--line-2:#111117;--pop-bg:rgba(11,11,16,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#e0e0e0;--accent-soft:#1f1f22;--accent-fg:#14141a;--sel:#2d2d2f;--mark:#e0e0e0;--mark-fill:#515155;--bg:#000003;--card:#08080c;--card-2:#040408;--pill:#121218;--pill-hover:#1b1b22;--line:#18181e;--line-2:#111117;--pop-bg:rgba(11,11,16,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#f2f2f5;--card-2:#f8f8fa;--pill-hover:#f4f4f7;--skel:#eeeef2;--skel-hi:#e2e2e8}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#f2f2f5;--card-2:#f8f8fa;--pill-hover:#f4f4f7;--skel:#eeeef2;--skel-hi:#e2e2e8}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#000105;--card:#0a0b11;--card-2:#06070c;--pill:#13141b;--pill-hover:#1d1e27}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#000105;--card:#0a0b11;--card-2:#06070c;--pill:#13141b;--pill-hover:#1d1e27}\n", + "#0d9488": "html:not(.omarchy):root{--accent:#0b7c72;--accent-soft:#e9f3f2;--accent-fg:#ffffff;--sel:#e4f1f0;--mark:#0a766d;--mark-fill:#e2efee;--bg:#f0f6f8;--card-2:#f5fbfd;--pill:#edf3f6;--pill-hover:#e5ebf0;--seg-track:#e2e8ed;--line:#dfe5ea;--line-2:#e8eef2}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#209d92;--accent-soft:#153031;--accent-fg:#14141a;--sel:#163737;--mark:#90cec8;--mark-fill:#2e5757;--bg:#131e21;--card:#1c272a;--card-2:#182326;--pill:#263136;--pill-hover:#2f3a40;--line:#2c373c;--line-2:#253035;--pop-bg:rgba(31,42,46,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#209d92;--accent-soft:#153031;--accent-fg:#14141a;--sel:#163737;--mark:#90cec8;--mark-fill:#2e5757;--bg:#131e21;--card:#1c272a;--card-2:#182326;--pill:#263136;--pill-hover:#2f3a40;--line:#2c373c;--line-2:#253035;--pop-bg:rgba(31,42,46,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#eef4f7;--card-2:#f4fafc;--pill-hover:#f0f6f9;--skel:#eaf0f4;--skel-hi:#dee4ea}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#eef4f7;--card-2:#f4fafc;--pill-hover:#f0f6f9;--skel:#eaf0f4;--skel-hi:#dee4ea}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#142023;--card:#1e2a2f;--card-2:#1a262a;--pill:#273339;--pill-hover:#313d45}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#142023;--card:#1e2a2f;--card-2:#1a262a;--pill:#273339;--pill-hover:#313d45}\n", + "#52525b": "html:not(.omarchy):root{--accent:#52525b;--accent-soft:#efeff0;--accent-fg:#ffffff;--sel:#ececed;--mark:#52525b;--mark-fill:#eaeaeb;--bg:#f4f4f6;--card-2:#f9f9fb;--pill:#f1f1f4;--pill-hover:#e9e9ee;--seg-track:#e6e6eb;--line:#e3e3e8;--line-2:#ececf0}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#89898f;--accent-soft:#29292e;--accent-fg:#14141a;--sel:#303035;--mark:#c1c1c4;--mark-fill:#4e4e54;--bg:#1a1a1e;--card:#232327;--card-2:#1f1f23;--pill:#2d2d33;--pill-hover:#36363d;--line:#333339;--line-2:#2c2c32;--pop-bg:rgba(38,38,43,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#89898f;--accent-soft:#29292e;--accent-fg:#14141a;--sel:#303035;--mark:#c1c1c4;--mark-fill:#4e4e54;--bg:#1a1a1e;--card:#232327;--card-2:#1f1f23;--pill:#2d2d33;--pill-hover:#36363d;--line:#333339;--line-2:#2c2c32;--pop-bg:rgba(38,38,43,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#f2f2f5;--card-2:#f8f8fa;--pill-hover:#f4f4f7;--skel:#eeeef2;--skel-hi:#e2e2e8}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#f2f2f5;--card-2:#f8f8fa;--pill-hover:#f4f4f7;--skel:#eeeef2;--skel-hi:#e2e2e8}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#1b1c20;--card:#25262c;--card-2:#212227;--pill:#2e2f36;--pill-hover:#383942}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#1b1c20;--card:#25262c;--card-2:#212227;--pill:#2e2f36;--pill-hover:#383942}\n", + "#7c3aed": "html:not(.omarchy):root{--accent:#7c3aed;--accent-soft:#f3edfd;--accent-fg:#ffffff;--sel:#f1e9fd;--mark:#7c3aed;--mark-fill:#efe7fd;--bg:#f3f0fb;--card-2:#f8f5ff;--pill:#f0edf9;--pill-hover:#e8e5f3;--seg-track:#e5e2f0;--line:#e2dfed;--line-2:#ebe8f5}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#a171f2;--accent-soft:#2c2142;--accent-fg:#14141a;--sel:#34264f;--mark:#cbb0f8;--mark-fill:#544473;--bg:#191326;--card:#221c2f;--card-2:#1e182b;--pill:#2c263b;--pill-hover:#352f45;--line:#322c41;--line-2:#2b253a;--pop-bg:rgba(37,31,51,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#a171f2;--accent-soft:#2c2142;--accent-fg:#14141a;--sel:#34264f;--mark:#cbb0f8;--mark-fill:#544473;--bg:#191326;--card:#221c2f;--card-2:#1e182b;--pill:#2c263b;--pill-hover:#352f45;--line:#322c41;--line-2:#2b253a;--pop-bg:rgba(37,31,51,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#f1eefa;--card-2:#f7f4ff;--pill-hover:#f3f0fc;--skel:#edeaf7;--skel-hi:#e1deed}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#f1eefa;--card-2:#f7f4ff;--pill-hover:#f3f0fc;--skel:#edeaf7;--skel-hi:#e1deed}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#1a1528;--card:#241f34;--card-2:#201b2f;--pill:#2d283e;--pill-hover:#37324a}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#1a1528;--card:#241f34;--card-2:#201b2f;--pill:#2d283e;--pill-hover:#37324a}\n", + "#db2777": "html:not(.omarchy):root{--accent:#ce2570;--accent-soft:#fbebf2;--accent-fg:#ffffff;--sel:#fae7ef;--mark:#c12269;--mark-fill:#f9e5ee;--bg:#f9f0f6;--card-2:#fef5fb;--pill:#f6edf4;--pill-hover:#eee5ee;--seg-track:#ebe2eb;--line:#e8dfe8;--line-2:#f1e8f0}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]){--accent:#e35795;--accent-soft:#3d1d2e;--accent-fg:#14141a;--sel:#482135;--mark:#f1a9c9;--mark-fill:#6b3c55;--bg:#21131d;--card:#2a1c26;--card-2:#261822;--pill:#342632;--pill-hover:#3d2f3c;--line:#3a2c38;--line-2:#332531;--pop-bg:rgba(45,31,42,.96)}}\nhtml:not(.omarchy):root[data-theme=\"dark\"]{--accent:#e35795;--accent-soft:#3d1d2e;--accent-fg:#14141a;--sel:#482135;--mark:#f1a9c9;--mark-fill:#6b3c55;--bg:#21131d;--card:#2a1c26;--card-2:#261822;--pill:#342632;--pill-hover:#3d2f3c;--line:#3a2c38;--line-2:#332531;--pop-bg:rgba(45,31,42,.96)}\n@media (prefers-color-scheme: light){html:not(.omarchy):root:not([data-theme=\"dark\"]) body.panel{--bg:#f7eef5;--card-2:#fdf4fa;--pill-hover:#f9f0f7;--skel:#f3eaf2;--skel-hi:#e7dee8}}\nhtml:not(.omarchy):root[data-theme=\"light\"] body.panel{--bg:#f7eef5;--card-2:#fdf4fa;--pill-hover:#f9f0f7;--skel:#f3eaf2;--skel-hi:#e7dee8}\n@media (prefers-color-scheme: dark){html:not(.omarchy):root:not([data-theme=\"light\"]) body.panel{--bg:#22151f;--card:#2c1f2b;--card-2:#281b26;--pill:#352835;--pill-hover:#3f3241}}\nhtml:not(.omarchy):root[data-theme=\"dark\"] body.panel{--bg:#22151f;--card:#2c1f2b;--card-2:#281b26;--pill:#352835;--pill-hover:#3f3241}\n" }