forge
Explore
Log in

Don't you dare go Hollow

Seven more accents and three more backgrounds

Browse files at this commit

5bed83d233b0d4acbb44ed3a42f5efdf9ff5b6f6Ahmet Kaan GümüşParent: 7663f1e
  • ui
    • seven more accents and three more backgrounds
Show full message
💄 ui: seven more accents and three more backgrounds

Accents: Teal, Moss, Indigo, Amber, Clay, Berry and Ember (13 in all). Backgrounds: Dune, Lilac and Dusk (8 in all). Every light and dark token pair passes WCAG AA for text on accent and accent ink on every background. Turkish names added. Tests cover the new ids, the store round-trip and the settings form.
crates/forge-core/src/store/ui_prefs.rsmodified+45 -0
@@ -294,6 +294,51 @@ mod tests {
294294 );
295295 }
296296
297+ #[tokio::test]
298+ async fn the_newer_accents_and_backgrounds_persist() {
299+ let dir = tempfile::tempdir().unwrap();
300+ let store = Store::open(&dir.path().join("forge.db")).await.unwrap();
301+ let user = store
302+ .create_user("tahinli", None, "hash", false)
303+ .await
304+ .unwrap();
305+
306+ store
307+ .set_colours(&user.id, "teal", "berry", "dune", "lilac")
308+ .await
309+ .unwrap();
310+ store
311+ .set_colours(&user.id, "clay", "indigo", "dusk", "dune")
312+ .await
313+ .unwrap();
314+ let stored = store.user_by_id(&user.id).await.unwrap().unwrap();
315+ assert_eq!(
316+ (
317+ stored.accent.as_str(),
318+ stored.accent_dark.as_str(),
319+ stored.base_light.as_str(),
320+ stored.base_dark.as_str()
321+ ),
322+ ("clay", "indigo", "dusk", "dune")
323+ );
324+
325+ assert!(
326+ store
327+ .set_colours(&user.id, "Teal", "berry", "dune", "lilac")
328+ .await
329+ .is_err()
330+ );
331+ assert!(
332+ store
333+ .set_colours(&user.id, "clay", "indigo", "Dusk", "dune")
334+ .await
335+ .is_err()
336+ );
337+ let still = store.user_by_id(&user.id).await.unwrap().unwrap();
338+ assert_eq!(still.accent, "clay");
339+ assert_eq!(still.base_light, "dusk");
340+ }
341+
297342 #[tokio::test]
298343 async fn set_accent_sets_both_accents_and_keeps_bases() {
299344 let dir = tempfile::tempdir().unwrap();
crates/forge-web/src/accent.rsmodified+24 -0
@@ -143,6 +143,30 @@ mod tests {
143143 assert!(!is_offered("removed-palette"));
144144 }
145145
146+ #[test]
147+ fn the_newer_accents_are_offered_by_their_exact_id() {
148+ for id in ["teal", "moss", "indigo", "amber", "clay", "berry", "ember"] {
149+ assert!(is_offered(id), "{id}");
150+ assert_eq!(resolve(id).id, id);
151+ }
152+ for id in ["Teal", "teal ", "terracotta", "clay-2", "Ember"] {
153+ assert!(!is_offered(id), "{id}");
154+ }
155+ assert_eq!(ids().count(), 13);
156+ }
157+
158+ #[test]
159+ fn the_newer_backgrounds_are_offered_by_their_exact_id() {
160+ for id in ["dune", "lilac", "dusk"] {
161+ assert!(is_offered_base(id), "{id}");
162+ assert_eq!(resolve_base(id).id, id);
163+ }
164+ for id in ["Dune", "dusk ", "slate-blue"] {
165+ assert!(!is_offered_base(id), "{id}");
166+ }
167+ assert_eq!(base_ids().count(), 8);
168+ }
169+
146170 #[test]
147171 fn unknown_and_removed_base_ids_fall_back_to_the_default() {
148172 assert_eq!(resolve_base("ink").id, "ink");
crates/forge-web/src/accent_palette.rsmodified+292 -0
@@ -251,6 +251,202 @@ pub const PALETTES: &[Palette] = &[
251251 hunk_text: "#A4B4C4",
252252 },
253253 },
254+ // Teal, a muted blue-green.
255+ Palette {
256+ id: "teal",
257+ light: Tokens {
258+ accent: "#437C7C",
259+ accent_ink: "#396A6A",
260+ accent_soft: "#E7F0F0",
261+ accent_text: "#FFFFFF",
262+ focus: "#396A6A",
263+ public_bg: "#E7F0F0",
264+ public_text: "#396A6A",
265+ note: "#396A6A",
266+ hunk_bg: "#F1F6F6",
267+ hunk_text: "#366464",
268+ },
269+ dark: Tokens {
270+ accent: "#4B8B8B",
271+ accent_ink: "#58A4A4",
272+ accent_soft: "#213030",
273+ accent_text: "#0F1515",
274+ focus: "#4B8B8B",
275+ public_bg: "#213030",
276+ public_text: "#58A4A4",
277+ note: "#58A4A4",
278+ hunk_bg: "#1A2323",
279+ hunk_text: "#58A4A4",
280+ },
281+ },
282+ // Olive green, earthier than Sage.
283+ Palette {
284+ id: "moss",
285+ light: Tokens {
286+ accent: "#697947",
287+ accent_ink: "#59673D",
288+ accent_soft: "#EDF0E8",
289+ accent_text: "#FFFFFF",
290+ focus: "#59673D",
291+ public_bg: "#EDF0E8",
292+ public_text: "#59673D",
293+ note: "#59673D",
294+ hunk_bg: "#F4F5F2",
295+ hunk_text: "#546139",
296+ },
297+ dark: Tokens {
298+ accent: "#758850",
299+ accent_ink: "#8AA05E",
300+ accent_soft: "#2B2F22",
301+ accent_text: "#131410",
302+ focus: "#758850",
303+ public_bg: "#2B2F22",
304+ public_text: "#8AA05E",
305+ note: "#8AA05E",
306+ hunk_bg: "#20231B",
307+ hunk_text: "#8AA05E",
308+ },
309+ },
310+ // Soft indigo, cooler than Plum.
311+ Palette {
312+ id: "indigo",
313+ light: Tokens {
314+ accent: "#646FB3",
315+ accent_ink: "#515DA5",
316+ accent_soft: "#E7E8F1",
317+ accent_text: "#FFFFFF",
318+ focus: "#515DA5",
319+ public_bg: "#E7E8F1",
320+ public_text: "#515DA5",
321+ note: "#515DA5",
322+ hunk_bg: "#F1F2F6",
323+ hunk_text: "#4E599F",
324+ },
325+ dark: Tokens {
326+ accent: "#717BB9",
327+ accent_ink: "#858EC3",
328+ accent_soft: "#202331",
329+ accent_text: "#0F1015",
330+ focus: "#717BB9",
331+ public_bg: "#202331",
332+ public_text: "#858EC3",
333+ note: "#858EC3",
334+ hunk_bg: "#191B24",
335+ hunk_text: "#858EC3",
336+ },
337+ },
338+ // Golden amber, warm and muted.
339+ Palette {
340+ id: "amber",
341+ light: Tokens {
342+ accent: "#936D22",
343+ accent_ink: "#7D5D1D",
344+ accent_soft: "#F5EFE2",
345+ accent_text: "#FFFFFF",
346+ focus: "#7D5D1D",
347+ public_bg: "#F5EFE2",
348+ public_text: "#7D5D1D",
349+ note: "#7D5D1D",
350+ hunk_bg: "#F8F5EF",
351+ hunk_text: "#75571B",
352+ },
353+ dark: Tokens {
354+ accent: "#A37A26",
355+ accent_ink: "#C3912E",
356+ accent_soft: "#382E1A",
357+ accent_text: "#17140C",
358+ focus: "#A37A26",
359+ public_bg: "#382E1A",
360+ public_text: "#C3912E",
361+ note: "#C3912E",
362+ hunk_bg: "#282215",
363+ hunk_text: "#C3912E",
364+ },
365+ },
366+ // Terracotta, a warm red-orange clay.
367+ Palette {
368+ id: "clay",
369+ light: Tokens {
370+ accent: "#AC5E46",
371+ accent_ink: "#93503C",
372+ accent_soft: "#F2E8E5",
373+ accent_text: "#FFFFFF",
374+ focus: "#93503C",
375+ public_bg: "#F2E8E5",
376+ public_text: "#93503C",
377+ note: "#93503C",
378+ hunk_bg: "#F6F2F1",
379+ hunk_text: "#8C4C39",
380+ },
381+ dark: Tokens {
382+ accent: "#B96A53",
383+ accent_ink: "#C3806B",
384+ accent_soft: "#33231F",
385+ accent_text: "#16100E",
386+ focus: "#B96A53",
387+ public_bg: "#33231F",
388+ public_text: "#C3806B",
389+ note: "#C3806B",
390+ hunk_bg: "#251B18",
391+ hunk_text: "#C3806B",
392+ },
393+ },
394+ // Deep berry, richer than Rose.
395+ Palette {
396+ id: "berry",
397+ light: Tokens {
398+ accent: "#AC5787",
399+ accent_ink: "#944973",
400+ accent_soft: "#F1E7ED",
401+ accent_text: "#FFFFFF",
402+ focus: "#944973",
403+ public_bg: "#F1E7ED",
404+ public_text: "#944973",
405+ note: "#944973",
406+ hunk_bg: "#F6F1F4",
407+ hunk_text: "#8D466E",
408+ },
409+ dark: Tokens {
410+ accent: "#B36692",
411+ accent_ink: "#BF7CA2",
412+ accent_soft: "#31202A",
413+ accent_text: "#150F12",
414+ focus: "#B36692",
415+ public_bg: "#31202A",
416+ public_text: "#BF7CA2",
417+ note: "#BF7CA2",
418+ hunk_bg: "#24191F",
419+ hunk_text: "#BF7CA2",
420+ },
421+ },
422+ // Forge-spark orange: hot metal, the most saturated accent on offer.
423+ Palette {
424+ id: "ember",
425+ light: Tokens {
426+ accent: "#C2410C",
427+ accent_ink: "#9A3412",
428+ accent_soft: "#FCEBE0",
429+ accent_text: "#FFFFFF",
430+ focus: "#9A3412",
431+ public_bg: "#FCEBE0",
432+ public_text: "#9A3412",
433+ note: "#9A3412",
434+ hunk_bg: "#FDF4EF",
435+ hunk_text: "#8F3110",
436+ },
437+ dark: Tokens {
438+ accent: "#FB923C",
439+ accent_ink: "#FDBA74",
440+ accent_soft: "#3A2010",
441+ accent_text: "#1C0D04",
442+ focus: "#FB923C",
443+ public_bg: "#3A2010",
444+ public_text: "#FDBA74",
445+ note: "#FDBA74",
446+ hunk_bg: "#2A1A0F",
447+ hunk_text: "#FB923C",
448+ },
449+ },
254450 ];
255451
256452 /// The neutral colour tokens one base sets in one theme. The values are CSS colours;
@@ -503,4 +699,100 @@ pub const BASES: &[Base] = &[
503699 ln_text: "#9C9C98",
504700 },
505701 },
702+ // Dune: warm beige, a step warmer and browner than Sand.
703+ Base {
704+ id: "dune",
705+ light: BaseTokens {
706+ bg: "#F4EBDC",
707+ surface: "#FCF8F1",
708+ surface_2: "#EDE3D1",
709+ text: "#2B2318",
710+ text_2: "#473F31",
711+ muted: "#6F6550",
712+ border: "#E0D5C1",
713+ border_strong: "#C9BBA2",
714+ code_bg: "#EDE3D1",
715+ private_bg: "#EDE3D1",
716+ private_text: "#473F31",
717+ ln_text: "#6A5F4C",
718+ },
719+ dark: BaseTokens {
720+ bg: "#17120B",
721+ surface: "#1F1912",
722+ surface_2: "#28211A",
723+ text: "#EEE6D8",
724+ text_2: "#D0C7B6",
725+ muted: "#A39A88",
726+ border: "#362E24",
727+ border_strong: "#483E31",
728+ code_bg: "#28211A",
729+ private_bg: "#28211A",
730+ private_text: "#D0C7B6",
731+ ln_text: "#A39A88",
732+ },
733+ },
734+ // Lilac: a soft cool violet tint.
735+ Base {
736+ id: "lilac",
737+ light: BaseTokens {
738+ bg: "#F5F3FA",
739+ surface: "#FFFFFF",
740+ surface_2: "#ECE9F5",
741+ text: "#1F1B2C",
742+ text_2: "#3B3650",
743+ muted: "#686180",
744+ border: "#DCD7EA",
745+ border_strong: "#C3BCD9",
746+ code_bg: "#ECE9F5",
747+ private_bg: "#ECE9F5",
748+ private_text: "#3B3650",
749+ ln_text: "#625B77",
750+ },
751+ dark: BaseTokens {
752+ bg: "#12101A",
753+ surface: "#1A1725",
754+ surface_2: "#221E2E",
755+ text: "#E7E4F0",
756+ text_2: "#C9C4D8",
757+ muted: "#9E97B0",
758+ border: "#2C2739",
759+ border_strong: "#3C3650",
760+ code_bg: "#221E2E",
761+ private_bg: "#221E2E",
762+ private_text: "#C9C4D8",
763+ ln_text: "#9E97B0",
764+ },
765+ },
766+ // Dusk: cool blue-grey, deeper and bluer than Mist.
767+ Base {
768+ id: "dusk",
769+ light: BaseTokens {
770+ bg: "#E9EEF5",
771+ surface: "#F8FAFD",
772+ surface_2: "#DCE3EE",
773+ text: "#161F2D",
774+ text_2: "#303D52",
775+ muted: "#56637A",
776+ border: "#CBD5E3",
777+ border_strong: "#AEBBCE",
778+ code_bg: "#DCE3EE",
779+ private_bg: "#DCE3EE",
780+ private_text: "#303D52",
781+ ln_text: "#505D73",
782+ },
783+ dark: BaseTokens {
784+ bg: "#0B1019",
785+ surface: "#121927",
786+ surface_2: "#1A2332",
787+ text: "#E0E7F1",
788+ text_2: "#BFC9D9",
789+ muted: "#8F9BB0",
790+ border: "#222D3E",
791+ border_strong: "#303D51",
792+ code_bg: "#1A2332",
793+ private_bg: "#1A2332",
794+ private_text: "#BFC9D9",
795+ ln_text: "#8F9BB0",
796+ },
797+ },
506798 ];
crates/forge-web/src/i18n/accents.rsmodified+20 -0
@@ -19,6 +19,20 @@ pub fn accent_name(lang: Lang, id: &str) -> &'static str {
1919 ("ochre", Lang::Tr) => "Toprak",
2020 ("slate", Lang::En) => "Slate",
2121 ("slate", Lang::Tr) => "Arduvaz",
22+ ("teal", Lang::En) => "Teal",
23+ ("teal", Lang::Tr) => "Camgöbeği",
24+ ("moss", Lang::En) => "Moss",
25+ ("moss", Lang::Tr) => "Yosun",
26+ ("indigo", Lang::En) => "Indigo",
27+ ("indigo", Lang::Tr) => "Çivit",
28+ ("amber", Lang::En) => "Amber",
29+ ("amber", Lang::Tr) => "Kehribar",
30+ ("clay", Lang::En) => "Clay",
31+ ("clay", Lang::Tr) => "Kil",
32+ ("berry", Lang::En) => "Berry",
33+ ("berry", Lang::Tr) => "Böğürtlen",
34+ ("ember", Lang::En) => "Ember",
35+ ("ember", Lang::Tr) => "Kor",
2236 _ => "",
2337 }
2438 }
@@ -37,6 +51,12 @@ pub fn base_name(lang: Lang, id: &str) -> &'static str {
3751 ("mist", Lang::Tr) => "Sis",
3852 ("ink", Lang::En) => "Ink",
3953 ("ink", Lang::Tr) => "Mürekkep",
54+ ("dune", Lang::En) => "Dune",
55+ ("dune", Lang::Tr) => "Kumul",
56+ ("lilac", Lang::En) => "Lilac",
57+ ("lilac", Lang::Tr) => "Leylak",
58+ ("dusk", Lang::En) => "Dusk",
59+ ("dusk", Lang::Tr) => "Alacakaranlık",
4060 _ => "",
4161 }
4262 }
crates/forge-web/src/pages/settings_appearance.rsmodified+14 -0
@@ -423,6 +423,20 @@ mod tests {
423423 assert!(base_choice(Lang::En, Some(""), "fern").is_err());
424424 }
425425
426+ #[test]
427+ fn the_newer_colours_pass_and_their_wrong_cases_do_not() {
428+ for id in ["teal", "moss", "indigo", "amber", "clay", "berry", "ember"] {
429+ assert_eq!(accent_choice(Lang::En, Some(id), "sage").unwrap(), id);
430+ assert!(accent_choice(Lang::Tr, Some(&id.to_uppercase()), "sage").is_err());
431+ }
432+ for id in ["dune", "lilac", "dusk"] {
433+ assert_eq!(base_choice(Lang::Tr, Some(id), "fern").unwrap(), id);
434+ assert!(base_choice(Lang::Tr, Some(&id.to_uppercase()), "fern").is_err());
435+ }
436+ assert!(accent_choice(Lang::En, Some("terracotta"), "sage").is_err());
437+ assert!(base_choice(Lang::En, Some("slate-blue"), "fern").is_err());
438+ }
439+
426440 #[test]
427441 fn an_absent_colour_keeps_the_stored_value() {
428442 assert_eq!(accent_choice(Lang::En, None, "plum").unwrap(), "plum");
crates/forge-web/tests/ui_prefs_e2e.rsmodified+23 -0
@@ -399,6 +399,29 @@ async fn light_and_dark_colours_save_independently_and_render_on_html() {
399399 let chosen = ["ocean", "plum", "ink", "sand"].map(str::to_owned);
400400 assert_eq!(checked_colours(&page.body), chosen.clone().map(Some));
401401 assert_eq!(html_colours(&page.body), chosen.map(Some));
402+
403+ // The newer accents and backgrounds save and show on the page the same way.
404+ let saved = env
405+ .http
406+ .post_form(
407+ "/settings/appearance",
408+ &[
409+ ("csrf", &csrf),
410+ ("theme", "light"),
411+ ("language", "tr"),
412+ ("accent_light", "teal"),
413+ ("accent_dark", "berry"),
414+ ("base_light", "dune"),
415+ ("base_dark", "dusk"),
416+ ],
417+ Some(&session),
418+ )
419+ .await;
420+ assert_eq!(saved.status, 303, "save: {}", saved.body);
421+ let page = env.http.get("/settings/appearance", Some(&session)).await;
422+ let chosen = ["teal", "berry", "dune", "dusk"].map(str::to_owned);
423+ assert_eq!(checked_colours(&page.body), chosen.clone().map(Some));
424+ assert_eq!(html_colours(&page.body), chosen.map(Some));
402425 }
403426
404427 #[tokio::test]