@@ -180,6 +180,10 @@ pub fn settings_reset_defaults(
180180
181181 timer. apply_settings ( new_settings. clone ( ) ) ;
182182 * tray_state. countdown_mode . lock ( ) . unwrap ( ) = new_settings. dial_countdown ;
183+ let data_dir = app. path ( ) . app_data_dir ( ) . map_err ( |e| e. to_string ( ) ) ?;
184+ if let Some ( theme) = themes:: find ( & data_dir, & new_settings. theme ) {
185+ * tray_state. colors . lock ( ) . unwrap ( ) = tray:: TrayColors :: from_colors_map ( & theme. colors ) ;
186+ }
183187 app. emit ( "settings:changed" , & new_settings) . ok ( ) ;
184188 Ok ( new_settings)
185189}
@@ -205,6 +209,8 @@ pub fn theme_apply(
205209 name : String ,
206210 app : AppHandle ,
207211 db : State < ' _ , DbState > ,
212+ tray_state : State < ' _ , Arc < TrayState > > ,
213+ timer : State < ' _ , TimerController > ,
208214) -> Result < Theme , String > {
209215 let data_dir = app
210216 . path ( )
@@ -221,6 +227,16 @@ pub fn theme_apply(
221227 settings:: load ( & conn) . map_err ( |e| e. to_string ( ) ) ?
222228 } ;
223229
230+ // Update tray colors and immediately re-render the icon for the new theme.
231+ * tray_state. colors . lock ( ) . unwrap ( ) = tray:: TrayColors :: from_colors_map ( & theme. colors ) ;
232+ let snap = timer. get_snapshot ( ) ;
233+ let progress = if snap. total_secs > 0 {
234+ snap. elapsed_secs as f32 / snap. total_secs as f32
235+ } else {
236+ 0.0
237+ } ;
238+ tray:: update_icon ( & tray_state, & snap. round_type , snap. is_paused , progress) ;
239+
224240 // Notify all windows so they can re-apply the new theme CSS.
225241 app. emit ( "settings:changed" , & updated_settings) . ok ( ) ;
226242
0 commit comments