feat: inactive window header icon/text colors
This commit is contained in:
parent
1355588723
commit
9292ea647b
2 changed files with 36 additions and 18 deletions
|
|
@ -373,7 +373,9 @@ pub enum Container {
|
||||||
Custom(Box<dyn Fn(&Theme) -> container::Appearance>),
|
Custom(Box<dyn Fn(&Theme) -> container::Appearance>),
|
||||||
Dialog,
|
Dialog,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
HeaderBar,
|
HeaderBar {
|
||||||
|
focused: bool,
|
||||||
|
},
|
||||||
List,
|
List,
|
||||||
Primary,
|
Primary,
|
||||||
Secondary,
|
Secondary,
|
||||||
|
|
@ -473,22 +475,36 @@ impl container::StyleSheet for Theme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Container::HeaderBar => container::Appearance {
|
Container::HeaderBar { focused } => {
|
||||||
icon_color: Some(Color::from(cosmic.accent.base)),
|
let (icon_color, text_color) = if *focused {
|
||||||
text_color: Some(Color::from(cosmic.background.on)),
|
(
|
||||||
background: Some(iced::Background::Color(cosmic.background.base.into())),
|
Color::from(cosmic.accent.base),
|
||||||
border: Border {
|
Color::from(cosmic.background.on),
|
||||||
radius: [
|
)
|
||||||
cosmic.corner_radii.radius_xs[0],
|
} else {
|
||||||
cosmic.corner_radii.radius_xs[1],
|
use crate::ext::ColorExt;
|
||||||
cosmic.corner_radii.radius_0[2],
|
let unfocused_color = Color::from(cosmic.background.component.on)
|
||||||
cosmic.corner_radii.radius_0[3],
|
.blend_alpha(cosmic.background.base.into(), 0.75);
|
||||||
]
|
(unfocused_color, unfocused_color)
|
||||||
.into(),
|
};
|
||||||
..Default::default()
|
|
||||||
},
|
container::Appearance {
|
||||||
shadow: Shadow::default(),
|
icon_color: Some(icon_color),
|
||||||
},
|
text_color: Some(text_color),
|
||||||
|
background: Some(iced::Background::Color(cosmic.background.base.into())),
|
||||||
|
border: Border {
|
||||||
|
radius: [
|
||||||
|
cosmic.corner_radii.radius_xs[0],
|
||||||
|
cosmic.corner_radii.radius_xs[1],
|
||||||
|
cosmic.corner_radii.radius_0[2],
|
||||||
|
cosmic.corner_radii.radius_0[3],
|
||||||
|
]
|
||||||
|
.into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
shadow: Shadow::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Container::ContextDrawer => {
|
Container::ContextDrawer => {
|
||||||
let mut appearance = crate::style::Container::primary(cosmic);
|
let mut appearance = crate::style::Container::primary(cosmic);
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,9 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
||||||
.padding(8)
|
.padding(8)
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
.apply(widget::container)
|
.apply(widget::container)
|
||||||
.style(crate::theme::Container::HeaderBar)
|
.style(crate::theme::Container::HeaderBar {
|
||||||
|
focused: self.focused,
|
||||||
|
})
|
||||||
.center_y()
|
.center_y()
|
||||||
.apply(widget::mouse_area);
|
.apply(widget::mouse_area);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue