fix(button): icon buttons should inherit text and icon color from container
This commit is contained in:
parent
11a73354ca
commit
c7dc5ab1ed
1 changed files with 6 additions and 20 deletions
|
|
@ -13,27 +13,27 @@ use crate::{
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub enum Button {
|
pub enum Button {
|
||||||
|
AppletIcon,
|
||||||
Custom {
|
Custom {
|
||||||
active: Box<dyn Fn(bool, &crate::Theme) -> Appearance>,
|
active: Box<dyn Fn(bool, &crate::Theme) -> Appearance>,
|
||||||
disabled: Box<dyn Fn(&crate::Theme) -> Appearance>,
|
disabled: Box<dyn Fn(&crate::Theme) -> Appearance>,
|
||||||
hovered: Box<dyn Fn(bool, &crate::Theme) -> Appearance>,
|
hovered: Box<dyn Fn(bool, &crate::Theme) -> Appearance>,
|
||||||
pressed: Box<dyn Fn(bool, &crate::Theme) -> Appearance>,
|
pressed: Box<dyn Fn(bool, &crate::Theme) -> Appearance>,
|
||||||
},
|
},
|
||||||
|
AppletMenu,
|
||||||
Destructive,
|
Destructive,
|
||||||
Link,
|
|
||||||
Icon,
|
|
||||||
HeaderBar,
|
HeaderBar,
|
||||||
|
Icon,
|
||||||
IconVertical,
|
IconVertical,
|
||||||
Image,
|
Image,
|
||||||
|
Link,
|
||||||
|
MenuItem,
|
||||||
|
MenuRoot,
|
||||||
#[default]
|
#[default]
|
||||||
Standard,
|
Standard,
|
||||||
Suggested,
|
Suggested,
|
||||||
Text,
|
Text,
|
||||||
Transparent,
|
Transparent,
|
||||||
AppletMenu,
|
|
||||||
AppletIcon,
|
|
||||||
MenuRoot,
|
|
||||||
MenuItem,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn appearance(
|
pub fn appearance(
|
||||||
|
|
@ -76,8 +76,6 @@ pub fn appearance(
|
||||||
}
|
}
|
||||||
|
|
||||||
let (background, text, icon) = color(&cosmic.icon_button);
|
let (background, text, icon) = color(&cosmic.icon_button);
|
||||||
appearance.text_color = text;
|
|
||||||
appearance.icon_color = icon;
|
|
||||||
appearance.background = Some(Background::Color(background));
|
appearance.background = Some(Background::Color(background));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,10 +160,6 @@ impl StyleSheet for crate::Theme {
|
||||||
) && selected
|
) && selected
|
||||||
{
|
{
|
||||||
Some(self.cosmic().accent_color().into())
|
Some(self.cosmic().accent_color().into())
|
||||||
} else if matches!(style, Button::HeaderBar) && !selected {
|
|
||||||
let mut c = Color::from(self.cosmic().background.on);
|
|
||||||
c.a = 0.75;
|
|
||||||
Some(c)
|
|
||||||
} else {
|
} else {
|
||||||
Some(component.on.into())
|
Some(component.on.into())
|
||||||
};
|
};
|
||||||
|
|
@ -211,10 +205,6 @@ impl StyleSheet for crate::Theme {
|
||||||
) && selected
|
) && selected
|
||||||
{
|
{
|
||||||
Some(self.cosmic().accent_color().into())
|
Some(self.cosmic().accent_color().into())
|
||||||
} else if matches!(style, Button::HeaderBar) && !selected {
|
|
||||||
let mut c = Color::from(component.on);
|
|
||||||
c.a = 0.8;
|
|
||||||
Some(c)
|
|
||||||
} else {
|
} else {
|
||||||
Some(component.on.into())
|
Some(component.on.into())
|
||||||
};
|
};
|
||||||
|
|
@ -236,10 +226,6 @@ impl StyleSheet for crate::Theme {
|
||||||
) && selected
|
) && selected
|
||||||
{
|
{
|
||||||
Some(self.cosmic().accent_color().into())
|
Some(self.cosmic().accent_color().into())
|
||||||
} else if matches!(style, Button::HeaderBar) && !selected {
|
|
||||||
let mut c = Color::from(component.on);
|
|
||||||
c.a = 0.8;
|
|
||||||
Some(c)
|
|
||||||
} else {
|
} else {
|
||||||
Some(component.on.into())
|
Some(component.on.into())
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue