diff --git a/crates/ui-egui/src/color_panel_tests.rs b/crates/ui-egui/src/color_panel_tests.rs index 65239d6a19..1152561d9f 100644 --- a/crates/ui-egui/src/color_panel_tests.rs +++ b/crates/ui-egui/src/color_panel_tests.rs @@ -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)); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 07c49f9098..8f1adf3ece 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -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,