refactor: add button components to theme because they have different overlays than others when they are hovered or pressed
This commit is contained in:
parent
1c5a233a98
commit
20a5227eca
4 changed files with 63 additions and 10 deletions
|
|
@ -233,13 +233,13 @@ impl Button {
|
|||
fn cosmic<'a>(&'a self, theme: &'a Theme) -> &CosmicComponent {
|
||||
let cosmic = theme.cosmic();
|
||||
match self {
|
||||
Button::Primary => &cosmic.accent,
|
||||
Button::Primary => &cosmic.accent_button,
|
||||
Button::Secondary => &theme.current_container().component,
|
||||
Button::Positive => &cosmic.success,
|
||||
Button::Destructive => &cosmic.destructive,
|
||||
Button::Text => &theme.current_container().component,
|
||||
Button::Link => &cosmic.accent,
|
||||
Button::LinkActive => &cosmic.accent,
|
||||
Button::Positive => &cosmic.success_button,
|
||||
Button::Destructive => &cosmic.destructive_button,
|
||||
Button::Text => &cosmic.text_button,
|
||||
Button::Link => &cosmic.accent_button,
|
||||
Button::LinkActive => &cosmic.accent_button,
|
||||
Button::Transparent => &TRANSPARENT_COMPONENT,
|
||||
Button::Deactivated => &theme.current_container().component,
|
||||
Button::Card => &theme.current_container().component,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use apply::Apply;
|
|||
use iced::{
|
||||
alignment::{Horizontal, Vertical},
|
||||
widget::{button, container, row},
|
||||
Alignment, Background, Length,
|
||||
Alignment, Length,
|
||||
};
|
||||
|
||||
pub struct SpinButton<'a, Message> {
|
||||
|
|
@ -98,11 +98,12 @@ fn container_style(theme: &crate::Theme) -> iced_style::container::Appearance {
|
|||
let basic = &theme.cosmic();
|
||||
let mut neutral_10 = basic.palette.neutral_10;
|
||||
neutral_10.alpha = 0.1;
|
||||
let accent = &theme.cosmic().accent;
|
||||
let accent = &basic.accent;
|
||||
let corners = &basic.corner_radii;
|
||||
iced_style::container::Appearance {
|
||||
text_color: Some(basic.palette.neutral_10.into()),
|
||||
background: Some(Background::Color(neutral_10.into())),
|
||||
border_radius: 24.0.into(),
|
||||
background: None,
|
||||
border_radius: corners.radius_s.into(),
|
||||
border_width: 0.0,
|
||||
border_color: accent.base.into(),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue