Skip to content

Commit d308ab1

Browse files
add white theme
1 parent beb7d06 commit d308ab1

File tree

2 files changed

+57
-15
lines changed

2 files changed

+57
-15
lines changed

src/gui/styles/container_styles.rs

+54-12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use super::theme::TroxideTheme;
12
use iced::widget::container::{Appearance, StyleSheet};
23
use iced::Background;
34
use iced::{color, Color};
@@ -7,13 +8,26 @@ pub struct ContainerThemeFirst;
78
impl StyleSheet for ContainerThemeFirst {
89
type Style = iced::Theme;
910

10-
fn appearance(&self, _style: &Self::Style) -> Appearance {
11-
Appearance {
12-
background: Some(Background::Color(color!(0x1c1c1c))),
13-
border_color: Color::BLACK,
11+
fn appearance(&self, style: &Self::Style) -> Appearance {
12+
let mut appearance = Appearance {
1413
border_width: 1.0,
1514
border_radius: 10.0,
1615
..Appearance::default()
16+
};
17+
18+
match style {
19+
iced::Theme::Custom(custom) => {
20+
if **custom == TroxideTheme::get_theme(&TroxideTheme::Light) {
21+
appearance.background = Some(Background::Color(color!(0xcccccc)));
22+
appearance.border_color = color!(0xbbbbbb);
23+
appearance
24+
} else {
25+
appearance.background = Some(Background::Color(color!(0x1c1c1c)));
26+
appearance.border_color = Color::BLACK;
27+
appearance
28+
}
29+
}
30+
_ => unreachable!("built-in iced themes are not in use"),
1731
}
1832
}
1933
}
@@ -23,13 +37,26 @@ pub struct ContainerThemeSecond;
2337
impl StyleSheet for ContainerThemeSecond {
2438
type Style = iced::Theme;
2539

26-
fn appearance(&self, _style: &Self::Style) -> Appearance {
27-
Appearance {
28-
background: Some(Background::Color(color!(0x282828))),
29-
border_color: Color::BLACK,
40+
fn appearance(&self, style: &Self::Style) -> Appearance {
41+
let mut appearance = Appearance {
3042
border_width: 1.0,
3143
border_radius: 10.0,
3244
..Appearance::default()
45+
};
46+
47+
match style {
48+
iced::Theme::Custom(custom) => {
49+
if **custom == TroxideTheme::get_theme(&TroxideTheme::Light) {
50+
appearance.background = Some(Background::Color(color!(0xbbbbbb)));
51+
appearance.border_color = color!(0xbbbbbb);
52+
appearance
53+
} else {
54+
appearance.background = Some(Background::Color(color!(0x282828)));
55+
appearance.border_color = Color::BLACK;
56+
appearance
57+
}
58+
}
59+
_ => unreachable!("built-in iced themes are not in use"),
3360
}
3461
}
3562
}
@@ -39,13 +66,28 @@ pub struct ContainerThemeReleaseTime;
3966
impl StyleSheet for ContainerThemeReleaseTime {
4067
type Style = iced::Theme;
4168

42-
fn appearance(&self, _style: &Self::Style) -> Appearance {
43-
Appearance {
44-
background: Some(Background::Color(Color::from_rgb(0.5, 0.5, 0.0))),
45-
border_color: Color::BLACK,
69+
fn appearance(&self, style: &Self::Style) -> Appearance {
70+
let mut appearance = Appearance {
71+
background: Some(Background::Color(color!(0x8f6593))),
72+
border_color: color!(0xbbbbbb),
4673
border_width: 1.0,
4774
border_radius: 1000.0, // Making sure it is circular
4875
..Appearance::default()
76+
};
77+
78+
match style {
79+
iced::Theme::Custom(custom) => {
80+
if **custom == TroxideTheme::get_theme(&TroxideTheme::Light) {
81+
appearance.background = Some(Background::Color(color!(0x8f6593)));
82+
appearance.border_color = color!(0xbbbbbb);
83+
appearance
84+
} else {
85+
appearance.background = Some(Background::Color(color!(0x8f6593)));
86+
appearance.border_color = Color::BLACK;
87+
appearance
88+
}
89+
}
90+
_ => unreachable!("built-in iced themes are not in use"),
4991
}
5092
}
5193
}

src/gui/styles/theme.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ impl TroxideTheme {
1212
pub fn get_theme(&self) -> Custom {
1313
match self {
1414
TroxideTheme::Light => Custom::new(Palette {
15-
background: Color::from_rgb(1.0, 0.9, 1.0),
15+
background: color!(0xdddddd),
1616
text: Color::BLACK,
17-
primary: Color::from_rgb(0.5, 0.5, 0.0),
17+
primary: color!(0x8f6593),
1818
success: Color::from_rgb(0.0, 1.0, 0.0),
1919
danger: Color::from_rgb(1.0, 0.0, 0.0),
2020
}),
2121
TroxideTheme::Dark => Custom::new(Palette {
2222
background: color!(0x161616),
2323
text: color!(0xcccccc),
24-
primary: Color::from_rgb(0.5, 0.5, 0.0),
24+
primary: color!(0x8f6593),
2525
success: Color::from_rgb(0.0, 1.0, 0.0),
2626
danger: Color::from_rgb(1.0, 0.0, 0.0),
2727
}),

0 commit comments

Comments
 (0)