Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Color Settings: reloading a profile moves it to the end of the replay list

Brandon Thomas45e30914fcf6
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index b35acabcb..359dc9b1a 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -2456,9 +2456,9 @@ pub fn show(app: &mut DesignApp, ctx: &egui::Context) {
{
match app.session.execute("color.loadProfile", &json!({"path": path})) {
Ok(_) => {
- if !app.ui.color_profiles.contains(&path) {
- app.ui.color_profiles.push(path);
- }
+ // Replayed in load order at start-up, so the latest load of a path comes last.
+ app.ui.color_profiles.retain(|p| p != &path);
+ app.ui.color_profiles.push(path);
let f = app.session.execute("color.settings", &json!({})).unwrap_or_default();
d.fields.insert("profiles".into(), f["profiles"].clone());
}