Repository navigation
Description
Reproduced on: main fbf7ed5 (built from source), Windows 11. The check was a test on solidcraft-theme, run once on that tree and not committed.
parse_accent (crates/theme/src/lib.rs:418) reads the Accent preference from #10968. It should take #rrggbb or "" and nothing else, but it also takes text with a + where the first digit belongs. It checks the length (six characters after the #). Then it gives the text to egui's Color32::from_hex, which reads all six characters with one u32::from_str_radix, and from_str_radix takes a leading +.
Steps
- Send
ui.prefs {"accent": "#+fffff"}over the control channel, or put"accent": "#+fffff"in the preferences file. - Use a theme that accepts an accent (Light or Dark).
The Accent row's colour field and its swatches can't make this text. The field writes #rrggbb itself, and since #16716 its hex box uses the strict rule in solidcraft_color::hex. So the colour field and swatches can't make it; only the control channel, an agent or a hand-edited preferences file can.
Expected
ui.prefs refuses it with its own message, "accent must be a colour as #rrggbb, or "" for the theme's own" (crates/ui-egui/src/prefs.rs:3078), and the preferences file falls back to the theme's accent.
Actual
parse_accent takes it, so ui.prefs's check at prefs.rs:3078 lets it through and the accent paints as that colour. I ran parse_accent itself, below; I didn't drive ui.prefs in the app.
parse_accent("#00ff00") -> Some([0, 255, 0, 255])
parse_accent("#+fffff") -> Some([15, 255, 255, 255]) (#0fffff)
parse_accent("#+0000f") -> Some([0, 0, 15, 255]) (#00000f)
parse_accent("#-ffff0") -> None
parse_accent("##00ff0") -> None
parse_accent("#0x00ff") -> None
parse_accent(" #ABCDEF ") -> Some([171, 205, 239, 255])
The fix I'd suggest
parse_accent reads through solidcraft_color::hex::parse after its trim, and refuses an alpha. That's the rule #16716 put in one place for theme files, the colour field, 3MF and the appearance dialog. solidcraft-theme already depends on solidcraft-color, so it's a few lines and no new dependency. A test beside the theme crate's tests would cover #+fffff and #+0000f, and keep ##00ff0 and #00ff00ff refused as they are today.
Hi @dudedagger42, thanks for the accent row in #10968. I found this while moving our command colour readers onto that same shared rule (#18745 / #18746). I've kept it out of that PR because the accent is your code, so it's all yours if you'd like it. If you'd rather I took it, just say and I'll open a small PR.
Activity
EldarPolitkin commentedon Nov 25, 2026
Confirmed on main
fc6907a7d3with a test onsolidcraft-theme(cargo test -p solidcraft-theme --lib), asserting thatparse_accentrefuses a sign after the#:Only a
+followed by five hex digits gets through.#+ffff,#-fffff,# fffff,#fffféand non-ASCII digits are already refused, and#3B82F6is still taken. The fix belongs inparse_accentitself (crates/theme/src/lib.rs), soui.prefs, the preferences file and the Interface page all get it. I'll take this one.EldarPolitkin commentedon Nov 25, 2026
/claim
github-actions commentedon Nov 25, 2026
Claimed by @EldarPolitkin. Please open a draft PR referencing #22089 within 72 h; the claim lapses otherwise.
/unclaimreleases it.