various: un-hardcode the sidebar text color - #613
Conversation
The vaxry sidebar hardcoded rgba(255,255,255,*) for section headers, nav items and the divider. On the theme-following surface a light palette (matugen light mode) renders that as white text on a near-white background. Mix from a --vaxry-sidebar-fg base instead: the theme text colour on the themed surface, still literal white on the fixed dark backgrounds (android drawer, artwork scrim).
📝 WalkthroughWalkthroughThe sidebar now defines ChangesSidebar theme colors
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/components/src/vaxry/sidebar.rs`:
- Around line 167-168: Update the style string in the Vaxry sidebar rendering
code to assign --vaxry-sidebar-fg from the selected theme’s text-color token
rather than the fixed --color-white value. Preserve the existing width and
background declarations.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f8dc38e2-669f-4182-b631-01f051ae0dd7
📒 Files selected for processing (1)
crates/components/src/vaxry/sidebar.rs
| "width: {current_width}px; background: var(--color-neutral-900); --vaxry-sidebar-fg: var(--color-white);" | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 5 --glob '*.{css,rs,ron,toml,html}' \
-- '--color-white|--color-neutral-900|--vaxry-sidebar-fg' .Repository: Kopuz-org/kopuz
Length of output: 50372
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== files with theme/color variable assignments =="
rg -n -C 3 --glob '*.{css,rs,ron,html,js,ts}' -- '--color-white|:root|color-scheme|theme' crates/kopuz/assets crates/utils/src/themes.rs crates/components/src/vaxry/sidebar.rs crates/components/src/source_switcher.rs | head -n 220
echo
echo "== variable definitions in tailwind.css =="
sed -n '1,70p' crates/kopuz/assets/tailwind.css
echo
echo "== theme source =="
sed -n '1,220p' crates/utils/src/themes.rsRepository: Kopuz-org/kopuz
Length of output: 50372
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import json, pathlib, re
for path in pathlib.Path("assets/themes.json").parent.glob("assets/themes.json"):
data = json.loads(path.read_text())
break
else:
print("NO THEMES_JSON")
raise SystemExit
re_vars = re.compile(r"--([A-Za-z0-9_-]+)")
print("themes:", [t["id"] for t in data.get("dark", []) + data.get("light", [])])
print("\n--color-white definitions:")
for theme in data.get("dark", []) + data.get("light", []):
if "--color-white" in theme.get("vars", {}):
print(f"{theme['id']} ({theme['kind']}): {theme['vars']['--color-white']}")
print("\n--color-neutral-900 definitions:")
for theme in data.get("dark", []) + data.get("light", []):
if "--color-neutral-900" in theme.get("vars", {}):
print(f"{theme['id']} ({theme['kind']}): {theme['vars']['--color-neutral-900']}")
print("\nthemes defining text color differently and background neutrals:")
for theme in data.get("dark", []) + data.get("light", []):
bg = theme.get("vars", {}).get("--color-neutral-900") or theme.get("vars", {}).get("--color-black")
text = theme.get("vars", {}).get("--color-white") or theme.get("vars", {}).get("--color-stone-600")
if text and text != "`#fff`" or bg and "hsl" in text:
print(theme["id"], theme["kind"], "bg=", bg, "text=", text)
PYRepository: Kopuz-org/kopuz
Length of output: 168
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== all themes.json locations =="
find . -path ./target -prune -o -name themes.json -print
echo
echo "== all token definitions in JSON themes =="
python3 - <<'PY'
import json, pathlib, re
for path in pathlib.Path("assets/themes.json").parent.glob("assets/themes.json"):
try:
data = json.loads(path.read_text())
except Exception as e:
print(f"ERROR {path}: {e}")
continue
print(f"FILE {path}")
white=[]
neutral900=[]
for theme in data.get("dark",[]) + data.get("light",[]):
for key in ("--color-white","--color-neutral-900","--color-black"):
if key in theme.get("vars",{}):
print(f"{theme.get('id')}/{theme.get('kind')} {key}: {theme['vars'][key]}")
if key == "--color-white": white.append((theme.get('id'), theme.get('kind'), theme['vars'][key]))
if key == "--color-neutral-900": neutral900.append((theme.get('id'), theme.get('kind'), theme['vars'][key]))
print("white definitions:", white)
print("neutral-900 definitions:", neutral900)
PY
echo
echo "== exact sidebar lines =="
sed -n '140,175p' crates/components/src/vaxry/sidebar.rs
echo
echo "== references to all_themes_css / theme vars =="
rg -n --glob '*.rs' 'all_themes_css|custom_theme_to_css|theme_map|theme-\{|\.theme-|--color-white|--color-neutral-900|--color-' crates | head -n 220Repository: Kopuz-org/kopuz
Length of output: 22481
Use a theme-following foreground token for the Vaxry sidebar.
--vaxry-sidebar-fg currently reads --color-white, which resolves to the fixed #fff fallback in the base CSS; the per-theme text color comes from --color-white in the theme map, not a separate token. Map the sidebar foreground to the selected theme’s text token so light themes do not render light foreground on a light sidebar.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/components/src/vaxry/sidebar.rs` around lines 167 - 168, Update the
style string in the Vaxry sidebar rendering code to assign --vaxry-sidebar-fg
from the selected theme’s text-color token rather than the fixed --color-white
value. Preserve the existing width and background declarations.
Since I am using matugen, kopuz can get in light mode. This is a bug I didn't see as I don't use light mode very often. This fixes the sidebar text color being hardcoded so that it can be any color, but mainly black in light mode depending on the theme.
Sanity Checking
rules.
contribution guidelines, or this pull request did not use AI assistance.
Style and Consistency
style.
cargo fmt --all --checkorcargo fmt --allas appropriate.cargo clippy --workspace --all-targets -- -D warnings, orexplained why it could not be run.
this change depends on them.
Testing
Tested on platform(s):
x86_64-linuxaarch64-linuxx86_64-darwinaarch64-darwin