Compare commits
5
Commits
f720fa00f4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5932990be | ||
|
|
aa4d0d8e61 | ||
|
|
cbcf5a3fa4 | ||
|
|
d8a9a5bb7d | ||
|
|
d272adcc4c |
No files matched your search
+1542
-3
File diff suppressed because it is too large.
Load diff
+96
-1
@@ -8,7 +8,7 @@ use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use iced::widget::{button, container};
|
||||
use iced::widget::{button, container, text_input};
|
||||
use iced::{Border, Color, Theme};
|
||||
|
||||
/// Accent red used for destructive/close affordances in both themes.
|
||||
@@ -162,6 +162,101 @@ pub fn outlined_option(theme: &Theme, status: button::Status) -> button::Style {
|
||||
}
|
||||
}
|
||||
|
||||
/// Style for a confirming action button (green).
|
||||
pub fn positive_option(theme: &Theme, status: button::Status) -> button::Style {
|
||||
let success = theme.extended_palette().success;
|
||||
filled_option(match status {
|
||||
button::Status::Hovered | button::Status::Pressed => success.strong,
|
||||
_ => success.base,
|
||||
})
|
||||
}
|
||||
|
||||
/// Style for a destructive/cancelling action button (red).
|
||||
pub fn danger_option(theme: &Theme, status: button::Status) -> button::Style {
|
||||
let danger = theme.extended_palette().danger;
|
||||
filled_option(match status {
|
||||
button::Status::Hovered | button::Status::Pressed => danger.strong,
|
||||
_ => danger.base,
|
||||
})
|
||||
}
|
||||
|
||||
fn filled_option(pair: iced::theme::palette::Pair) -> button::Style {
|
||||
button::Style {
|
||||
background: Some(pair.color.into()),
|
||||
text_color: pair.text,
|
||||
border: Border {
|
||||
color: pair.color,
|
||||
width: 1.0,
|
||||
radius: 4.0.into(),
|
||||
},
|
||||
..button::Style::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Style for the password eye button while the password is revealed.
|
||||
pub fn revealed_eye(theme: &Theme, status: button::Status) -> button::Style {
|
||||
let palette = theme.extended_palette();
|
||||
|
||||
button::Style {
|
||||
background: None,
|
||||
text_color: palette.background.base.text,
|
||||
border: Border {
|
||||
color: palette.primary.base.color,
|
||||
width: 1.0,
|
||||
radius: 4.0.into(),
|
||||
},
|
||||
..button::text(theme, status)
|
||||
}
|
||||
}
|
||||
|
||||
/// Style for a selectable list row; the selected one gets a tinted background.
|
||||
pub fn selectable_row(theme: &Theme, status: button::Status, selected: bool) -> button::Style {
|
||||
if selected {
|
||||
let palette = theme.extended_palette();
|
||||
|
||||
button::Style {
|
||||
background: Some(palette.primary.weak.color.into()),
|
||||
text_color: palette.primary.weak.text,
|
||||
border: Border {
|
||||
radius: 3.0.into(),
|
||||
..Border::default()
|
||||
},
|
||||
..button::Style::default()
|
||||
}
|
||||
} else {
|
||||
let mut style = button::text(theme, status);
|
||||
|
||||
if matches!(status, button::Status::Hovered) {
|
||||
style.background =
|
||||
Some(theme.extended_palette().background.weak.color.into());
|
||||
}
|
||||
|
||||
style
|
||||
}
|
||||
}
|
||||
|
||||
/// Style for filter/text fields: a thicker outline while focused.
|
||||
pub fn filter_field(theme: &Theme, status: text_input::Status) -> text_input::Style {
|
||||
let palette = theme.extended_palette();
|
||||
let mut style = text_input::default(theme, status);
|
||||
|
||||
style.border = if matches!(status, text_input::Status::Focused { .. }) {
|
||||
Border {
|
||||
color: palette.primary.strong.color,
|
||||
width: 2.0,
|
||||
radius: 4.0.into(),
|
||||
}
|
||||
} else {
|
||||
Border {
|
||||
color: palette.background.strong.color,
|
||||
width: 1.0,
|
||||
radius: 4.0.into(),
|
||||
}
|
||||
};
|
||||
|
||||
style
|
||||
}
|
||||
|
||||
/// Style for the settings window frame.
|
||||
pub fn settings_frame(theme: &Theme) -> container::Style {
|
||||
let palette = theme.extended_palette();
|
||||
|
||||
Reference in new issue
Block a user