Settings checkboxes have their own style

The default text color field recently added in Iced is set to Color::Black which is not suitable for UAD
This commit is contained in:
0x192 2021-12-20 02:38:56 +01:00
commit 72ba0ab02b
No known key found for this signature in database
GPG key ID: 34D27465928A0A1D
2 changed files with 34 additions and 6 deletions

View file

@ -285,7 +285,7 @@ impl checkbox::StyleSheet for SelectionCheckBox {
border_radius: 5.0,
border_width: 1.0,
border_color: palette.base.background,
text_color: Color::BLACK,
text_color: palette.bright.surface,
},
Self::Disabled(palette) => checkbox::Style {
background: Background::Color(palette.base.foreground),
@ -293,7 +293,7 @@ impl checkbox::StyleSheet for SelectionCheckBox {
border_radius: 5.0,
border_width: 1.0,
border_color: palette.normal.primary,
text_color: Color::BLACK,
text_color: palette.bright.surface,
},
}
}
@ -306,7 +306,7 @@ impl checkbox::StyleSheet for SelectionCheckBox {
border_radius: 5.0,
border_width: 2.0,
border_color: palette.normal.primary,
text_color: Color::BLACK,
text_color: palette.bright.surface,
},
Self::Disabled(_) => checkbox::Style {
@ -316,6 +316,31 @@ impl checkbox::StyleSheet for SelectionCheckBox {
}
}
pub struct SettingsCheckbox(pub ColorPalette);
impl checkbox::StyleSheet for SettingsCheckbox {
fn active(&self, _is_checked: bool) -> checkbox::Style {
checkbox::Style {
background: Background::Color(self.0.base.background),
checkmark_color: self.0.bright.primary,
border_radius: 5.0,
border_width: 1.0,
border_color: self.0.bright.primary,
text_color: self.0.bright.surface,
}
}
fn hovered(&self, _is_checked: bool) -> checkbox::Style {
checkbox::Style {
background: Background::Color(self.0.base.foreground),
checkmark_color: self.0.bright.primary,
border_radius: 5.0,
border_width: 2.0,
border_color: self.0.bright.primary,
text_color: self.0.bright.surface,
}
}
}
pub struct SearchInput(pub ColorPalette);
impl text_input::StyleSheet for SearchInput {
fn active(&self) -> text_input::Style {

View file

@ -101,7 +101,8 @@ impl Settings {
self.phone.expert_mode,
"Allow to uninstall packages marked as \"unsafe\" (I KNOW WHAT I AM DOING)",
Message::ExpertMode,
);
)
.style(style::SettingsCheckbox(self.theme.palette));
let disable_mode_descr = Text::new("Default mode on older phone (< Android 8.0) where uninstalled packages can't be restored.")
.size(15)
@ -111,7 +112,8 @@ impl Settings {
self.phone.disable_mode,
"Clear and disable packages instead of uninstalling them",
Message::DisableMode,
);
)
.style(style::SettingsCheckbox(self.theme.palette));
let multi_user_mode_descr =
Text::new("Disabling this setting will typically prevent affecting your work profile")
@ -122,7 +124,8 @@ impl Settings {
self.phone.multi_user_mode,
"Affect all the users of the phone (not only the selected user)",
Message::MultiUserMode,
);
)
.style(style::SettingsCheckbox(self.theme.palette));
let content = Column::new()
.width(Length::Fill)