Color panel state: still read Only Web Colors under its old web_only key (#6000)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Khawar Zamman WaniandClaude Opus 5.5 committed 2026-10-18 15:52:34 +05:30
1 parent 3a5e7cf0b0
commit f89ce5ce07
2 files changed
+12 -2

No files matched your search

+9
View File
@@ -326,3 +326,12 @@ fn control_sets_the_mode_ramp_and_web_safe_ramp() {
assert_eq!(app.ui.color_panel, cp, "{bad}: nothing changes");
}
}
/// Only Web Colors is `webOnly` now that the state is camelCase; state saved before still loads.
#[test]
fn web_only_reads_its_old_snake_case_key() {
let old: crate::state::ColorPanelState = serde_json::from_value(json!({"background": true, "web_only": true})).unwrap();
assert!(old.background && old.web_only);
let new = serde_json::to_value(old).unwrap();
assert_eq!((new.get("webOnly"), new.get("web_only")), (Some(&json!(true)), None));
}
+3 -2
View File
@@ -1054,8 +1054,9 @@ pub struct DockTabs {
pub struct ColorPanelState {
/// The panel edits the background colour (its chip was clicked), not the foreground.
pub background: bool,
/// Color Picker › Only Web Colors, kept across opens like Photoshop (#4995).
#[serde(default)]
/// Color Picker › Only Web Colors, kept across opens like Photoshop (#4995). `web_only` is
/// its name before the camelCase rename (#6000).
#[serde(default, alias = "web_only")]
pub web_only: bool,
/// What the panel shows, picked from its panel menu as in Photoshop (#6000).
pub mode: ColorPanelMode,