@@ -41,6 +41,7 @@ pub fn appearance(
41
41
theme : & crate :: Theme ,
42
42
focused : bool ,
43
43
selected : bool ,
44
+ disabled : bool ,
44
45
style : & Button ,
45
46
color : impl Fn ( & Component ) -> ( Color , Option < Color > , Option < Color > ) ,
46
47
) -> Appearance {
@@ -83,8 +84,9 @@ pub fn appearance(
83
84
84
85
let ( background, text, icon) = color ( & cosmic. icon_button ) ;
85
86
appearance. background = Some ( Background :: Color ( background) ) ;
86
- appearance. text_color = text;
87
- appearance. icon_color = icon;
87
+ // Only override icon button colors when it is disabled
88
+ appearance. icon_color = if disabled { icon } else { None } ;
89
+ appearance. text_color = if disabled { text } else { None } ;
88
90
}
89
91
90
92
Button :: Image => {
@@ -169,7 +171,7 @@ impl StyleSheet for crate::Theme {
169
171
return active ( focused, self ) ;
170
172
}
171
173
172
- appearance ( self , focused, selected, style, move |component| {
174
+ appearance ( self , focused, selected, false , style, move |component| {
173
175
let text_color = if matches ! (
174
176
style,
175
177
Button :: Icon | Button :: IconVertical | Button :: HeaderBar
@@ -189,7 +191,7 @@ impl StyleSheet for crate::Theme {
189
191
return disabled ( self ) ;
190
192
}
191
193
192
- appearance ( self , false , false , style, |component| {
194
+ appearance ( self , false , false , true , style, |component| {
193
195
let mut background = Color :: from ( component. base ) ;
194
196
background. a *= 0.5 ;
195
197
(
@@ -213,6 +215,7 @@ impl StyleSheet for crate::Theme {
213
215
self ,
214
216
focused || matches ! ( style, Button :: Image ) ,
215
217
selected,
218
+ false ,
216
219
style,
217
220
|component| {
218
221
let text_color = if matches ! (
@@ -235,7 +238,7 @@ impl StyleSheet for crate::Theme {
235
238
return pressed ( focused, self ) ;
236
239
}
237
240
238
- appearance ( self , focused, selected, style, |component| {
241
+ appearance ( self , focused, selected, false , style, |component| {
239
242
let text_color = if matches ! (
240
243
style,
241
244
Button :: Icon | Button :: IconVertical | Button :: HeaderBar
0 commit comments