feat: add support for dark / light mode switching (#178)

* feat: add support for dark / light mode switching and simultaneouscustom light / dark mode themes

* refactor(color-picker): optional initial color and fallback color

* refactor: used FixedPortion for layout of the settings item

This makes sure that the control always has at least the specified portion of the available space

* refactor: make all members of the ThemeBuilder public

* refactor: add and update palette colors

* fix(theme): typo and derive PartialEq for ThemeBuilder

* fix: update color picker usage

* feat: add more variables to the theme

* fix: radius on headerbar

* fix: Theme CosmicConfigEntry impl

* chore: specify rev of taffy

* fix: theme CosmicConfigEntry missing variables

* fix: apply theme type when theme mode changes

* wip: add plus icon to empty color picker button

* chore: fix rev and imports

* refactor(color-picker): allow custom size for the icon

* refactor(color_picker): make color_button public

* update iced
This commit is contained in:
Ashley Wulber 2023-10-16 16:19:04 -04:00 committed by GitHub
parent a91deacff5
commit 7cc791a3f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 542 additions and 164 deletions

View file

@ -8,8 +8,9 @@ use cosmic::{
iced_core::Color,
theme::ThemeType,
widget::{
button, cosmic_container::container, icon, segmented_button, segmented_selection, settings,
spin_button, toggler, view_switcher, ColorPickerModel, ColorPickerUpdate,
button, color_picker::ColorPickerUpdate, cosmic_container::container, icon,
segmented_button, segmented_selection, settings, spin_button, toggler, view_switcher,
ColorPickerModel,
},
Element,
};
@ -160,12 +161,7 @@ impl Default for State {
"card 4".to_string(),
],
timeline: Rc::new(RefCell::new(Default::default())),
color_picker_model: ColorPickerModel::new(
"Hex",
"RGB",
Color::new(0.8, 0.3, 0.8, 1.0),
None,
),
color_picker_model: ColorPickerModel::new("Hex", "RGB", None, None),
}
}
}
@ -524,7 +520,9 @@ impl State {
.on_input(Message::InputChanged)
.into(),
self.color_picker_model
.picker_button(Message::ColorPickerUpdate)
.picker_button(Message::ColorPickerUpdate, None)
.width(Length::Fixed(128.0))
.height(Length::Fixed(128.0))
.into(),
if self.color_picker_model.get_is_active() {
self.color_picker_model

@ -1 +1 @@
Subproject commit 13b5a947df963232cafb938de62e81b1df0dbac8
Subproject commit ed4af4e6431e30702f6de8031f3a3a11b82da3f0