now online

This commit is contained in:
Your Name 2025-05-14 23:24:21 +02:00
parent c6bb9ec5a6
commit 378d004587
9 changed files with 102 additions and 4222 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
target/*
Cargo.lock

4215
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@ freedesktop-icons = "*"
[dependencies.iced]
#git = "https://github.com/ibaryshnikov/iced.git"
#rev = "901bbeb"
features = ["wgpu","lazy","svg","advanced"]
features = ["wgpu","lazy","svg","advanced","markdown","highlighter"]
path = "../iced"
[dependencies.iced_winit]

View file

@ -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()

View file

@ -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;

View file

@ -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
View 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))
}
}

View file

@ -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;

View file

@ -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,
};