feat(color): add CAD indexed color picker

This commit is contained in:
gianlucafiore committed 2026-08-09 23:40:55 -03:00
1 parent 60f5bca0d4
commit 4697e8cc33
4 files changed
+293 -21

No files matched your search

+41 -16
View File
@@ -1850,24 +1850,49 @@ impl OpenCADStudio {
}
None => composed.into(),
};
// iced_aw owns the colour-picker overlay and keeps it above whichever
// application modal requested it.
// Shared CAD colour picker. Indexed ACI colours use OpenCADStudio's own
// dialog; True Color keeps the existing iced_aw gradient picker.
if let Some((_, current)) = self.color_pick_target.as_ref() {
let initial = crate::ui::properties::acad_color_display(*current).0;
let modal_base =
crate::ui::modal::backdrop(base, Message::CloseColorPicker);
iced_aw::ColorPicker::new(
true,
initial,
modal_base,
Message::CloseColorPicker,
|color| {
Message::ColorWindowPick(
crate::ui::color_select::iced_to_acad_color(color),
match self.color_picker_tab {
super::ColorPickerTab::Index => {
let content = crate::ui::color_select::index_color_page(
*current,
&self.recent_colors,
);
crate::ui::modal::modal(
base,
"Select Color",
content,
Message::CloseColorPicker,
self.modal_offset,
crate::ui::modal::ModalOptions::NOTICE,
)
},
)
.into()
}
super::ColorPickerTab::TrueColor => {
let initial = crate::ui::properties::acad_color_display(*current).0;
let modal_base =
crate::ui::modal::backdrop(base, Message::CloseColorPicker);
iced_aw::ColorPicker::new(
true,
initial,
modal_base,
// Cancel inside True Color returns to the indexed page instead
// of closing the whole CAD colour picker.
Message::ColorPickerTabChanged(super::ColorPickerTab::Index),
|color| {
Message::ColorWindowPick(
crate::ui::color_select::iced_to_acad_color(color),
)
},
)
.into()
}
}
} else {
base
}