Compare commits

...
3 Commits
Author SHA1 Message Date
terminarandClaude Opus 5.5 c5d7bdfef0 contrast palette: cyan instead of yellow accent in dark mode
The dashboards use yellow as a status color (warning, "gelb"); a
yellow accent made accent badges and links read as warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 23:04:13 +01:00
terminarandClaude Opus 5.5 e09effa2ca Default primary #2595c8, the family's button color
Every consumer styled .btn-primary as #2595c8 (hover #1d7baa) in its
own stylesheet; with that as the default palette's --yw-primary the
template's Bootstrap bridge matches it, and the consumers' hard-coded
rules can go so that the other palettes reach their buttons too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 23:01:28 +01:00
terminarandClaude Opus 5.5 148062ec28 ApplyAppearance: cut BasePath only as a whole path segment
Behind http.StripPrefix the request path is already relative, and a
blind TrimPrefix turned /release-notes into "elease-notes" for
BasePath /r, sending the menu back to the start page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 23:00:50 +01:00
3 changed files with 39 additions and 16 deletions

No files matched your search

+11 -1
View File
@@ -67,7 +67,17 @@ func (h *PageHeader) ApplyAppearance(r *http.Request) {
if c, err := r.Cookie(PaletteCookie); err == nil && known(Palettes, c.Value) {
h.Palette = c.Value
}
back := url.URL{Path: strings.TrimPrefix(r.URL.Path, h.BasePath), RawQuery: r.URL.RawQuery}
// Only a whole leading BasePath segment is cut: behind
// http.StripPrefix the path is already relative, and "/r" must not
// eat the start of "/release-notes".
path := r.URL.Path
if h.BasePath != "" && (path == h.BasePath || strings.HasPrefix(path, h.BasePath+"/")) {
path = strings.TrimPrefix(path, h.BasePath)
}
if path == "" {
path = "/"
}
back := url.URL{Path: path, RawQuery: r.URL.RawQuery}
h.AppearanceBack = back.String()
}
+9
View File
@@ -142,6 +142,15 @@ func TestApplyAppearance(t *testing.T) {
if h.AppearanceBack != "/tasks?f=1" {
t.Errorf("AppearanceBack = %q, want %q", h.AppearanceBack, "/tasks?f=1")
}
// Behind http.StripPrefix the path is already relative to BasePath.
for path, want := range map[string]string{"/release-notes": "/release-notes", "/r": "/", "/r/x": "/x"} {
h := PageHeader{BasePath: "/r"}
h.ApplyAppearance(httptest.NewRequest(http.MethodGet, path, nil))
if h.AppearanceBack != want {
t.Errorf("BasePath /r, path %s: AppearanceBack = %q, want %q", path, h.AppearanceBack, want)
}
}
}
func TestAppearanceHandler(t *testing.T) {
+19 -15
View File
@@ -82,8 +82,8 @@
--yw-link-rgb: var(--yw-if-light, 10, 114, 163) var(--yw-if-dark, 79, 195, 247);
--yw-link-hover: light-dark(#085a80, #81d4fa);
--yw-link-hover-rgb: var(--yw-if-light, 8, 90, 128) var(--yw-if-dark, 129, 212, 250);
--yw-primary: light-dark(#0d6efd, #0d6efd);
--yw-primary-rgb: var(--yw-if-light, 13, 110, 253) var(--yw-if-dark, 13, 110, 253);
--yw-primary: light-dark(#2595c8, #2595c8);
--yw-primary-rgb: var(--yw-if-light, 37, 149, 200) var(--yw-if-dark, 37, 149, 200);
--yw-on-primary: light-dark(#ffffff, #ffffff);
--yw-nav-link: light-dark(#0b82b8, #0b82b8);
--yw-nav-link-hover-text: light-dark(#0a4f72, #c8d4e4);
@@ -141,8 +141,10 @@
--yw-info-text: light-dark(#463a59, #c4adff);
}
/* contrast: high contrast for readability -- black/white, yellow
accent in dark mode, deep blue in light. */
/* contrast: high contrast for readability -- black/white, a bright
cyan accent in dark mode, deep blue in light. Not the classic yellow:
in these dashboards yellow means "warning", and an accent in that
color reads as a status. */
:root[data-palette="contrast"] {
--yw-bg: light-dark(#ffffff, #000000);
--yw-bg-rgb: var(--yw-if-light, 255, 255, 255) var(--yw-if-dark, 0, 0, 0);
@@ -158,17 +160,17 @@
--yw-border: light-dark(#555555, #8a8a8a);
--yw-chrome-bg: light-dark(#ffffff, #000000);
--yw-chrome-border: light-dark(#555555, #8a8a8a);
--yw-brand: light-dark(#0040a0, #ffd60a);
--yw-accent: light-dark(#0040a0, #ffd60a);
--yw-accent-rgb: var(--yw-if-light, 0, 64, 160) var(--yw-if-dark, 255, 214, 10);
--yw-link: light-dark(#0040a0, #ffd60a);
--yw-link-rgb: var(--yw-if-light, 0, 64, 160) var(--yw-if-dark, 255, 214, 10);
--yw-link-hover: light-dark(#002a6b, #ffe766);
--yw-link-hover-rgb: var(--yw-if-light, 0, 42, 107) var(--yw-if-dark, 255, 231, 102);
--yw-primary: light-dark(#0040a0, #ffd60a);
--yw-primary-rgb: var(--yw-if-light, 0, 64, 160) var(--yw-if-dark, 255, 214, 10);
--yw-brand: light-dark(#0040a0, #66e0ff);
--yw-accent: light-dark(#0040a0, #66e0ff);
--yw-accent-rgb: var(--yw-if-light, 0, 64, 160) var(--yw-if-dark, 102, 224, 255);
--yw-link: light-dark(#0040a0, #66e0ff);
--yw-link-rgb: var(--yw-if-light, 0, 64, 160) var(--yw-if-dark, 102, 224, 255);
--yw-link-hover: light-dark(#002a6b, #b3f0ff);
--yw-link-hover-rgb: var(--yw-if-light, 0, 42, 107) var(--yw-if-dark, 179, 240, 255);
--yw-primary: light-dark(#0040a0, #66e0ff);
--yw-primary-rgb: var(--yw-if-light, 0, 64, 160) var(--yw-if-dark, 102, 224, 255);
--yw-on-primary: light-dark(#ffffff, #000000);
--yw-nav-link: light-dark(#00549e, #7fd4ff);
--yw-nav-link: light-dark(#00549e, #a8e6ff);
--yw-nav-link-hover-text: light-dark(#000000, #ffffff);
--yw-subtitle: light-dark(#333333, #d0d0d0);
--yw-subtitle-sep: light-dark(#888888, #8a8a8a);
@@ -246,7 +248,9 @@
}
/* Bootstrap writes its primary blue straight into these components
rather than reading --bs-primary, so they get the palette's here. */
rather than reading --bs-primary, so they get the palette's here.
The default palette's #2595c8 is the button color every consumer's
own stylesheet used (as yasta), so those rules can go. */
.btn-primary {
--bs-btn-color: var(--yw-on-primary);
--bs-btn-bg: var(--yw-primary);