1
+ use super :: theme:: TroxideTheme ;
1
2
use iced:: widget:: container:: { Appearance , StyleSheet } ;
2
3
use iced:: Background ;
3
4
use iced:: { color, Color } ;
@@ -7,13 +8,26 @@ pub struct ContainerThemeFirst;
7
8
impl StyleSheet for ContainerThemeFirst {
8
9
type Style = iced:: Theme ;
9
10
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 {
14
13
border_width : 1.0 ,
15
14
border_radius : 10.0 ,
16
15
..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" ) ,
17
31
}
18
32
}
19
33
}
@@ -23,13 +37,26 @@ pub struct ContainerThemeSecond;
23
37
impl StyleSheet for ContainerThemeSecond {
24
38
type Style = iced:: Theme ;
25
39
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 {
30
42
border_width : 1.0 ,
31
43
border_radius : 10.0 ,
32
44
..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" ) ,
33
60
}
34
61
}
35
62
}
@@ -39,13 +66,28 @@ pub struct ContainerThemeReleaseTime;
39
66
impl StyleSheet for ContainerThemeReleaseTime {
40
67
type Style = iced:: Theme ;
41
68
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 ) ,
46
73
border_width : 1.0 ,
47
74
border_radius : 1000.0 , // Making sure it is circular
48
75
..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" ) ,
49
91
}
50
92
}
51
93
}
0 commit comments