now online
This commit is contained in:
parent
c6bb9ec5a6
commit
378d004587
9 changed files with 102 additions and 4222 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
target/*
|
||||||
|
Cargo.lock
|
||||||
4215
Cargo.lock
generated
4215
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -12,7 +12,7 @@ freedesktop-icons = "*"
|
||||||
[dependencies.iced]
|
[dependencies.iced]
|
||||||
#git = "https://github.com/ibaryshnikov/iced.git"
|
#git = "https://github.com/ibaryshnikov/iced.git"
|
||||||
#rev = "901bbeb"
|
#rev = "901bbeb"
|
||||||
features = ["wgpu","lazy","svg","advanced"]
|
features = ["wgpu","lazy","svg","advanced","markdown","highlighter"]
|
||||||
path = "../iced"
|
path = "../iced"
|
||||||
|
|
||||||
[dependencies.iced_winit]
|
[dependencies.iced_winit]
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,46 @@ impl Catalog for Theme {
|
||||||
class(self, status)
|
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 {
|
pub fn text_button(theme: &Theme, status: Status) -> Style {
|
||||||
match status {
|
match status {
|
||||||
|
|
@ -127,19 +167,19 @@ pub fn selected(theme: &Theme, _status: Status) -> Style {
|
||||||
pub fn secondary(theme: &Theme, status: Status) -> Style {
|
pub fn secondary(theme: &Theme, status: Status) -> Style {
|
||||||
match status {
|
match status {
|
||||||
Status::Active | Status::Pressed => Style {
|
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,
|
text_color: theme.colors().accent.base,
|
||||||
border: Border {
|
border: Border {
|
||||||
radius: 3.0.into(),
|
radius: 10.0.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Status::Hovered => Style {
|
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,
|
text_color: theme.colors().accent.base,
|
||||||
border: Border {
|
border: Border {
|
||||||
radius: 3.0.into(),
|
radius: 10.0.into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..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 {
|
pub fn grey(theme: &Theme) -> Style {
|
||||||
let background = theme.colors().background.darker;
|
let background = theme.colors().background.darker;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use iced::Color;
|
use iced::Color;
|
||||||
use palette::rgb::Rgb;
|
|
||||||
use palette::{DarkenAssign, FromColor, LightenAssign, Mix, Okhsl, Srgb};
|
use palette::{DarkenAssign, FromColor, LightenAssign, Mix, Okhsl, Srgb};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[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 checkbox;
|
||||||
pub mod container;
|
pub mod container;
|
||||||
pub mod data;
|
pub mod data;
|
||||||
|
pub mod markdown;
|
||||||
pub mod menu;
|
pub mod menu;
|
||||||
pub mod pick_list;
|
pub mod pick_list;
|
||||||
pub mod scrollable;
|
pub mod scrollable;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use iced::{
|
use iced::{
|
||||||
widget::{
|
widget::{
|
||||||
container,
|
container,
|
||||||
scrollable::{Catalog, Rail, Scrollbar, Scroller, Status, Style, StyleFn},
|
scrollable::{Catalog, Rail, Scroller, Status, Style, StyleFn},
|
||||||
},
|
},
|
||||||
Background, Border, Color, Shadow,
|
Background, Border, Color, Shadow,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue