From a2b0feddd68769d48ddd895ed43402af40250371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 22 Oct 2026 08:09:47 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20ui:=20nine=20more=20accents=20an?= =?UTF-8?q?d=20three=20more=20backgrounds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Accents: Crimson, Coral, Gold, Lime, Mint, Cyan, Sky, Violet and Fuchsia (22 in all). Backgrounds: Blush, Graphite and Pine (11 in all). Every light and dark pair passes the WCAG AA targets the existing set is held to. Gold takes dark text on its accent. Turkish names added. The colour pickers are CSS grids with equal columns, so Background and Accent rows share column lines. The light and dark theme cards stack at full width, which gives 11 columns on desktop: the 11 backgrounds are one row and the 22 accents two. Medium cards get 6 columns and phone 4. Names sit under their swatches and are cut with an ellipsis if a column is too narrow. Tests cover the new ids, the counts and the settings form. --- crates/forge-web/src/accent.rs | 23 +- crates/forge-web/src/accent_palette.rs | 348 ++++++++++++++++++ crates/forge-web/src/i18n/accents.rs | 24 ++ .../src/pages/settings_appearance.rs | 7 +- crates/forge-web/tests/ui_prefs_e2e.rs | 23 ++ style/main.scss | 50 ++- 6 files changed, 457 insertions(+), 18 deletions(-) diff --git a/crates/forge-web/src/accent.rs b/crates/forge-web/src/accent.rs index badf3d7..5941d8b 100644 --- a/crates/forge-web/src/accent.rs +++ b/crates/forge-web/src/accent.rs @@ -145,26 +145,37 @@ mod tests { #[test] fn the_newer_accents_are_offered_by_their_exact_id() { - for id in ["teal", "moss", "indigo", "amber", "clay", "berry", "ember"] { + for id in [ + "teal", "moss", "indigo", "amber", "clay", "berry", "ember", "crimson", "coral", + "gold", "lime", "mint", "cyan", "sky", "violet", "fuchsia", + ] { assert!(is_offered(id), "{id}"); assert_eq!(resolve(id).id, id); } - for id in ["Teal", "teal ", "terracotta", "clay-2", "Ember"] { + for id in [ + "Teal", + "teal ", + "terracotta", + "clay-2", + "Ember", + "Crimson", + "rust", + ] { assert!(!is_offered(id), "{id}"); } - assert_eq!(ids().count(), 13); + assert_eq!(ids().count(), 22); } #[test] fn the_newer_backgrounds_are_offered_by_their_exact_id() { - for id in ["dune", "lilac", "dusk"] { + for id in ["dune", "lilac", "dusk", "blush", "graphite", "pine"] { assert!(is_offered_base(id), "{id}"); assert_eq!(resolve_base(id).id, id); } - for id in ["Dune", "dusk ", "slate-blue"] { + for id in ["Dune", "dusk ", "slate-blue", "Pine"] { assert!(!is_offered_base(id), "{id}"); } - assert_eq!(base_ids().count(), 8); + assert_eq!(base_ids().count(), 11); } #[test] diff --git a/crates/forge-web/src/accent_palette.rs b/crates/forge-web/src/accent_palette.rs index 0323988..8981692 100644 --- a/crates/forge-web/src/accent_palette.rs +++ b/crates/forge-web/src/accent_palette.rs @@ -447,6 +447,258 @@ pub const PALETTES: &[Palette] = &[ hunk_text: "#FB923C", }, }, + // Red, pure and saturated, a clear step past Rose and Berry. + Palette { + id: "crimson", + light: Tokens { + accent: "#B3263A", + accent_ink: "#9E1C2E", + accent_soft: "#F8E3E6", + accent_text: "#FFFFFF", + focus: "#9E1C2E", + public_bg: "#F8E3E6", + public_text: "#9E1C2E", + note: "#9E1C2E", + hunk_bg: "#FBF1F2", + hunk_text: "#9E1C2E", + }, + dark: Tokens { + accent: "#F0707F", + accent_ink: "#FFA3AE", + accent_soft: "#3A1419", + accent_text: "#2A0A0E", + focus: "#F0707F", + public_bg: "#3A1419", + public_text: "#FFA3AE", + note: "#FFA3AE", + hunk_bg: "#2A1417", + hunk_text: "#F0707F", + }, + }, + // Salmon-orange, brighter and lighter than Clay. + Palette { + id: "coral", + light: Tokens { + accent: "#C4493A", + accent_ink: "#B0402F", + accent_soft: "#FBE6E1", + accent_text: "#FFFFFF", + focus: "#B0402F", + public_bg: "#FBE6E1", + public_text: "#B0402F", + note: "#B0402F", + hunk_bg: "#FDF3F0", + hunk_text: "#B0402F", + }, + dark: Tokens { + accent: "#FF8A7A", + accent_ink: "#FFADA0", + accent_soft: "#3A1B15", + accent_text: "#2A0C08", + focus: "#FF8A7A", + public_bg: "#3A1B15", + public_text: "#FFADA0", + note: "#FFADA0", + hunk_bg: "#2C1511", + hunk_text: "#FF8A7A", + }, + }, + // Bright yellow, lighter and more lemon than Amber, so it takes dark text. + Palette { + id: "gold", + light: Tokens { + accent: "#D4A017", + accent_ink: "#7D5A00", + accent_soft: "#F8F0D6", + accent_text: "#1F1700", + focus: "#7D5A00", + public_bg: "#F8F0D6", + public_text: "#7D5A00", + note: "#7D5A00", + hunk_bg: "#FCF8EA", + hunk_text: "#7D5A00", + }, + dark: Tokens { + accent: "#E8BC4A", + accent_ink: "#F5D27A", + accent_soft: "#3A2E0E", + accent_text: "#1F1700", + focus: "#E8BC4A", + public_bg: "#3A2E0E", + public_text: "#F5D27A", + note: "#F5D27A", + hunk_bg: "#2A220D", + hunk_text: "#E8BC4A", + }, + }, + // Yellow-green, a fresh step brighter than Moss. + Palette { + id: "lime", + light: Tokens { + accent: "#5C7A00", + accent_ink: "#4F6A00", + accent_soft: "#EEF5DC", + accent_text: "#FFFFFF", + focus: "#4F6A00", + public_bg: "#EEF5DC", + public_text: "#4F6A00", + note: "#4F6A00", + hunk_bg: "#F6FAEC", + hunk_text: "#4F6A00", + }, + dark: Tokens { + accent: "#A3D130", + accent_ink: "#C2E664", + accent_soft: "#263311", + accent_text: "#141A03", + focus: "#A3D130", + public_bg: "#263311", + public_text: "#C2E664", + note: "#C2E664", + hunk_bg: "#1C2510", + hunk_text: "#A3D130", + }, + }, + // Soft green-cyan, lighter and cooler than Sage. + Palette { + id: "mint", + light: Tokens { + accent: "#2E7D62", + accent_ink: "#22664F", + accent_soft: "#E0F4EC", + accent_text: "#FFFFFF", + focus: "#22664F", + public_bg: "#E0F4EC", + public_text: "#22664F", + note: "#22664F", + hunk_bg: "#EFF9F5", + hunk_text: "#22664F", + }, + dark: Tokens { + accent: "#6FD3AE", + accent_ink: "#9BE6CA", + accent_soft: "#14332A", + accent_text: "#0A1F17", + focus: "#6FD3AE", + public_bg: "#14332A", + public_text: "#9BE6CA", + note: "#9BE6CA", + hunk_bg: "#10251F", + hunk_text: "#6FD3AE", + }, + }, + // Bright blue-green, clearer than Teal. + Palette { + id: "cyan", + light: Tokens { + accent: "#00728A", + accent_ink: "#00677D", + accent_soft: "#DDF3F6", + accent_text: "#FFFFFF", + focus: "#00677D", + public_bg: "#DDF3F6", + public_text: "#00677D", + note: "#00677D", + hunk_bg: "#EEF9FB", + hunk_text: "#00677D", + }, + dark: Tokens { + accent: "#4DD0E1", + accent_ink: "#8BE4F0", + accent_soft: "#0E3036", + accent_text: "#03181B", + focus: "#4DD0E1", + public_bg: "#0E3036", + public_text: "#8BE4F0", + note: "#8BE4F0", + hunk_bg: "#0B2327", + hunk_text: "#4DD0E1", + }, + }, + // Clear sky blue, brighter than Ocean. + Palette { + id: "sky", + light: Tokens { + accent: "#1A6FB0", + accent_ink: "#1A64A0", + accent_soft: "#E1EFFA", + accent_text: "#FFFFFF", + focus: "#1A64A0", + public_bg: "#E1EFFA", + public_text: "#1A64A0", + note: "#1A64A0", + hunk_bg: "#EFF6FC", + hunk_text: "#1A64A0", + }, + dark: Tokens { + accent: "#7CC4F0", + accent_ink: "#A6D8F7", + accent_soft: "#13293A", + accent_text: "#061826", + focus: "#7CC4F0", + public_bg: "#13293A", + public_text: "#A6D8F7", + note: "#A6D8F7", + hunk_bg: "#0F202D", + hunk_text: "#7CC4F0", + }, + }, + // Vivid blue-purple, more saturated than Indigo. + Palette { + id: "violet", + light: Tokens { + accent: "#7C3AED", + accent_ink: "#6D34C9", + accent_soft: "#EEE7FC", + accent_text: "#FFFFFF", + focus: "#6D34C9", + public_bg: "#EEE7FC", + public_text: "#6D34C9", + note: "#6D34C9", + hunk_bg: "#F6F2FD", + hunk_text: "#6D34C9", + }, + dark: Tokens { + accent: "#B794F6", + accent_ink: "#CDB5FA", + accent_soft: "#2A1F45", + accent_text: "#15092E", + focus: "#B794F6", + public_bg: "#2A1F45", + public_text: "#CDB5FA", + note: "#CDB5FA", + hunk_bg: "#201832", + hunk_text: "#B794F6", + }, + }, + // Hot magenta-pink, the brightest purple-pink on offer. + Palette { + id: "fuchsia", + light: Tokens { + accent: "#A21CAF", + accent_ink: "#8F1A9A", + accent_soft: "#F8E3F5", + accent_text: "#FFFFFF", + focus: "#8F1A9A", + public_bg: "#F8E3F5", + public_text: "#8F1A9A", + note: "#8F1A9A", + hunk_bg: "#FBF1FA", + hunk_text: "#8F1A9A", + }, + dark: Tokens { + accent: "#E879F9", + accent_ink: "#F2A6FB", + accent_soft: "#3A1638", + accent_text: "#2A0530", + focus: "#E879F9", + public_bg: "#3A1638", + public_text: "#F2A6FB", + note: "#F2A6FB", + hunk_bg: "#2C1229", + hunk_text: "#E879F9", + }, + }, ]; /// The neutral colour tokens one base sets in one theme. The values are CSS colours; @@ -795,4 +1047,100 @@ pub const BASES: &[Base] = &[ ln_text: "#8F9BB0", }, }, + // Blush: a soft warm pink tint, the only pink page on offer. + Base { + id: "blush", + light: BaseTokens { + bg: "#FAF1F3", + surface: "#FFFFFF", + surface_2: "#F2E4E8", + text: "#2D1A20", + text_2: "#4A2F38", + muted: "#76606A", + border: "#E6D5DA", + border_strong: "#CFBAC1", + code_bg: "#F2E4E8", + private_bg: "#F2E4E8", + private_text: "#4A2F38", + ln_text: "#6C5660", + }, + dark: BaseTokens { + bg: "#150F12", + surface: "#1D1519", + surface_2: "#261C21", + text: "#F0E4E8", + text_2: "#D3C3C9", + muted: "#A3929A", + border: "#35282E", + border_strong: "#473840", + code_bg: "#261C21", + private_bg: "#261C21", + private_text: "#D3C3C9", + ln_text: "#A3929A", + }, + }, + // Graphite: a cool neutral grey, darker and flatter than Stone. + Base { + id: "graphite", + light: BaseTokens { + bg: "#E9EAEC", + surface: "#F9FAFB", + surface_2: "#DCDEE2", + text: "#17191C", + text_2: "#33373D", + muted: "#5C626B", + border: "#CFD3D9", + border_strong: "#B5BBC3", + code_bg: "#DCDEE2", + private_bg: "#DCDEE2", + private_text: "#33373D", + ln_text: "#545A63", + }, + dark: BaseTokens { + bg: "#1A1B1E", + surface: "#222428", + surface_2: "#2B2D32", + text: "#E6E8EB", + text_2: "#C8CCD2", + muted: "#9499A2", + border: "#33363C", + border_strong: "#44484F", + code_bg: "#2B2D32", + private_bg: "#2B2D32", + private_text: "#C8CCD2", + ln_text: "#9499A2", + }, + }, + // Pine: a teal-green tint, clearly bluer than Fern. + Base { + id: "pine", + light: BaseTokens { + bg: "#E8F3F0", + surface: "#FFFFFF", + surface_2: "#DAEAE5", + text: "#13211E", + text_2: "#2E403C", + muted: "#5A6E69", + border: "#CCE0DA", + border_strong: "#B3CCC4", + code_bg: "#DAEAE5", + private_bg: "#DAEAE5", + private_text: "#2E403C", + ln_text: "#52675F", + }, + dark: BaseTokens { + bg: "#0A1614", + surface: "#11211E", + surface_2: "#182C28", + text: "#DDEEE9", + text_2: "#BAD2CB", + muted: "#8AA59E", + border: "#213A34", + border_strong: "#2F4C45", + code_bg: "#182C28", + private_bg: "#182C28", + private_text: "#BAD2CB", + ln_text: "#8AA59E", + }, + }, ]; diff --git a/crates/forge-web/src/i18n/accents.rs b/crates/forge-web/src/i18n/accents.rs index 5bde8cc..0b6c075 100644 --- a/crates/forge-web/src/i18n/accents.rs +++ b/crates/forge-web/src/i18n/accents.rs @@ -33,6 +33,24 @@ pub fn accent_name(lang: Lang, id: &str) -> &'static str { ("berry", Lang::Tr) => "Böğürtlen", ("ember", Lang::En) => "Ember", ("ember", Lang::Tr) => "Kor", + ("crimson", Lang::En) => "Crimson", + ("crimson", Lang::Tr) => "Kızıl", + ("coral", Lang::En) => "Coral", + ("coral", Lang::Tr) => "Mercan", + ("gold", Lang::En) => "Gold", + ("gold", Lang::Tr) => "Altın", + ("lime", Lang::En) => "Lime", + ("lime", Lang::Tr) => "Misket", + ("mint", Lang::En) => "Mint", + ("mint", Lang::Tr) => "Nane", + ("cyan", Lang::En) => "Cyan", + ("cyan", Lang::Tr) => "Turkuaz", + ("sky", Lang::En) => "Sky", + ("sky", Lang::Tr) => "Gökyüzü", + ("violet", Lang::En) => "Violet", + ("violet", Lang::Tr) => "Menekşe", + ("fuchsia", Lang::En) => "Fuchsia", + ("fuchsia", Lang::Tr) => "Fuşya", _ => "", } } @@ -57,6 +75,12 @@ pub fn base_name(lang: Lang, id: &str) -> &'static str { ("lilac", Lang::Tr) => "Leylak", ("dusk", Lang::En) => "Dusk", ("dusk", Lang::Tr) => "Alacakaranlık", + ("blush", Lang::En) => "Blush", + ("blush", Lang::Tr) => "Pudra", + ("graphite", Lang::En) => "Graphite", + ("graphite", Lang::Tr) => "Grafit", + ("pine", Lang::En) => "Pine", + ("pine", Lang::Tr) => "Çam", _ => "", } } diff --git a/crates/forge-web/src/pages/settings_appearance.rs b/crates/forge-web/src/pages/settings_appearance.rs index 7e49102..3fa8f04 100644 --- a/crates/forge-web/src/pages/settings_appearance.rs +++ b/crates/forge-web/src/pages/settings_appearance.rs @@ -425,11 +425,14 @@ mod tests { #[test] fn the_newer_colours_pass_and_their_wrong_cases_do_not() { - for id in ["teal", "moss", "indigo", "amber", "clay", "berry", "ember"] { + for id in [ + "teal", "moss", "indigo", "amber", "clay", "berry", "ember", "crimson", "coral", + "gold", "lime", "mint", "cyan", "sky", "violet", "fuchsia", + ] { assert_eq!(accent_choice(Lang::En, Some(id), "sage").unwrap(), id); assert!(accent_choice(Lang::Tr, Some(&id.to_uppercase()), "sage").is_err()); } - for id in ["dune", "lilac", "dusk"] { + for id in ["dune", "lilac", "dusk", "blush", "graphite", "pine"] { assert_eq!(base_choice(Lang::Tr, Some(id), "fern").unwrap(), id); assert!(base_choice(Lang::Tr, Some(&id.to_uppercase()), "fern").is_err()); } diff --git a/crates/forge-web/tests/ui_prefs_e2e.rs b/crates/forge-web/tests/ui_prefs_e2e.rs index 2302119..8c7d256 100644 --- a/crates/forge-web/tests/ui_prefs_e2e.rs +++ b/crates/forge-web/tests/ui_prefs_e2e.rs @@ -422,6 +422,29 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() { let chosen = ["teal", "berry", "dune", "dusk"].map(str::to_owned); assert_eq!(checked_colours(&page.body), chosen.clone().map(Some)); assert_eq!(html_colours(&page.body), chosen.map(Some)); + + // The newest accents and backgrounds save and show the same way. + let saved = env + .http + .post_form( + "/settings/appearance", + &[ + ("csrf", &csrf), + ("theme", "light"), + ("language", "en"), + ("accent_light", "crimson"), + ("accent_dark", "fuchsia"), + ("base_light", "pine"), + ("base_dark", "graphite"), + ], + Some(&session), + ) + .await; + assert_eq!(saved.status, 303, "save: {}", saved.body); + let page = env.http.get("/settings/appearance", Some(&session)).await; + let chosen = ["crimson", "fuchsia", "pine", "graphite"].map(str::to_owned); + assert_eq!(checked_colours(&page.body), chosen.clone().map(Some)); + assert_eq!(html_colours(&page.body), chosen.map(Some)); } #[tokio::test] diff --git a/style/main.scss b/style/main.scss index 02d648b..e3fa479 100644 --- a/style/main.scss +++ b/style/main.scss @@ -2167,15 +2167,13 @@ code { } } +// One theme card per row, so each card is wide enough for 11 labelled colour columns. The light +// card and the dark card are the same shape, so they still line up. .appearance-columns { display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); + grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; - - @media (max-width: 720px) { - grid-template-columns: minmax(0, 1fr); - } } .colour-group { @@ -2213,18 +2211,50 @@ code { } } +// The picker is a grid with equal columns, so rows are exact and the Background and Accent rows +// share column lines. The card is the container: wide cards get 11 columns (the 11 backgrounds +// are one row, the 22 accents two), medium cards 6, and phone cards 4. +.colour-group { + container-type: inline-size; +} + .colour-choices { - display: flex; - flex-wrap: wrap; - gap: 8px 14px; + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 12px 4px; +} + +@container (min-width: 30rem) { + .colour-choices { + grid-template-columns: repeat(6, minmax(0, 1fr)); + } +} + +@container (min-width: 34rem) { + .colour-choices { + grid-template-columns: repeat(11, minmax(0, 1fr)); + gap: 12px 2px; + } } .colour-choice { - display: inline-flex; + display: flex; + flex-direction: column; align-items: center; - gap: 8px; + gap: 4px; + min-width: 0; position: relative; cursor: pointer; + text-align: center; + + // The name sits under its swatch. A name too long for its column is cut with an ellipsis. + > span:last-child { + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 0.75rem; + } input { position: absolute;