now online
This commit is contained in:
parent
c6bb9ec5a6
commit
378d004587
9 changed files with 102 additions and 4222 deletions
|
|
@ -14,6 +14,46 @@ impl Catalog for Theme {
|
|||
class(self, status)
|
||||
}
|
||||
}
|
||||
pub fn succes(theme: &Theme, status: Status) -> Style {
|
||||
match status {
|
||||
Status::Active | Status::Pressed => Style {
|
||||
background: Some(Background::Color(theme.colors().accent.high_alpha)),
|
||||
text_color: theme.colors().accent.base,
|
||||
border: Border {
|
||||
radius: 3.0.into(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
Status::Hovered => Style {
|
||||
background: Some(Background::Color(theme.colors().accent.med_alpha)),
|
||||
text_color: theme.colors().accent.base,
|
||||
border: Border {
|
||||
radius: 3.0.into(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
Status::Disabled => {
|
||||
let active = secondary(theme, Status::Active);
|
||||
|
||||
Style {
|
||||
text_color: Color {
|
||||
a: 0.2,
|
||||
..active.text_color
|
||||
},
|
||||
border: Border {
|
||||
color: Color {
|
||||
a: 0.2,
|
||||
..active.text_color
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
..active
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn text_button(theme: &Theme, status: Status) -> Style {
|
||||
match status {
|
||||
|
|
@ -127,19 +167,19 @@ pub fn selected(theme: &Theme, _status: Status) -> Style {
|
|||
pub fn secondary(theme: &Theme, status: Status) -> Style {
|
||||
match status {
|
||||
Status::Active | Status::Pressed => Style {
|
||||
background: Some(Background::Color(theme.colors().accent.high_alpha)),
|
||||
background: Some(Background::Color(theme.colors().background.dark)),
|
||||
text_color: theme.colors().accent.base,
|
||||
border: Border {
|
||||
radius: 3.0.into(),
|
||||
radius: 10.0.into(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
Status::Hovered => Style {
|
||||
background: Some(Background::Color(theme.colors().accent.med_alpha)),
|
||||
background: Some(Background::Color(theme.colors().background.lightest)),
|
||||
text_color: theme.colors().accent.base,
|
||||
border: Border {
|
||||
radius: 3.0.into(),
|
||||
radius: 10.0.into(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
|
|
|
|||
|
|
@ -15,6 +15,27 @@ impl Catalog for Theme {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn secondary_rounded(theme: &Theme) -> Style {
|
||||
let background = theme.colors().accent.darkest;
|
||||
|
||||
Style {
|
||||
background: Some(Background::Color(background)),
|
||||
text_color: Some(theme.colors().text.base),
|
||||
border: Border::default().rounded(10),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
pub fn grey_rounded(theme: &Theme) -> Style {
|
||||
let background = theme.colors().background.darker;
|
||||
|
||||
Style {
|
||||
background: Some(Background::Color(background)),
|
||||
text_color: Some(theme.colors().text.base),
|
||||
border: Border::default().rounded(10),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn grey(theme: &Theme) -> Style {
|
||||
let background = theme.colors().background.darker;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use iced::Color;
|
||||
use palette::rgb::Rgb;
|
||||
use palette::{DarkenAssign, FromColor, LightenAssign, Mix, Okhsl, Srgb};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
|||
32
src/theme/markdown.rs
Normal file
32
src/theme/markdown.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
use crate::theme::container::grey;
|
||||
use iced::{
|
||||
widget::{
|
||||
container,
|
||||
markdown::{self, Catalog, Style},
|
||||
},
|
||||
Border, Padding,
|
||||
};
|
||||
|
||||
use super::Theme;
|
||||
|
||||
impl Catalog for Theme {
|
||||
fn code_block<'a>() -> <Self as container::Catalog>::Class<'a> {
|
||||
Box::new(grey)
|
||||
}
|
||||
}
|
||||
pub fn light_grey(theme: &Theme) -> Style {
|
||||
Style {
|
||||
link_color: theme.colors().success.dark,
|
||||
inline_code_padding: Padding::from(5),
|
||||
inline_code_color: theme.colors().text.base,
|
||||
inline_code_highlight: iced::advanced::text::Highlight {
|
||||
background: iced::Background::Color(theme.colors().background.base),
|
||||
border: Border::default().rounded(5),
|
||||
},
|
||||
}
|
||||
}
|
||||
impl From<&Theme> for markdown::Settings {
|
||||
fn from(value: &Theme) -> Self {
|
||||
markdown::Settings::with_style(light_grey(value))
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ pub mod button;
|
|||
pub mod checkbox;
|
||||
pub mod container;
|
||||
pub mod data;
|
||||
pub mod markdown;
|
||||
pub mod menu;
|
||||
pub mod pick_list;
|
||||
pub mod scrollable;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use iced::{
|
||||
widget::{
|
||||
container,
|
||||
scrollable::{Catalog, Rail, Scrollbar, Scroller, Status, Style, StyleFn},
|
||||
scrollable::{Catalog, Rail, Scroller, Status, Style, StyleFn},
|
||||
},
|
||||
Background, Border, Color, Shadow,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue