File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -11,27 +11,15 @@ class NotificationObserver < Croft::Class
1111
1212 export_instance_method " themeChanged:" , def theme_changed (notice : Croft ::String )
1313 # notification = NSNotification.new(notice)
14- case current_theme
15- when / light/i
14+ case Mode .current
15+ when . light?
1616 # 🌝 🌞 🌕 🌙 🌜
1717 puts(" 🌕 setting #{ Mode ::Light .theme} " ) if @verbose
1818 ThemeController .set_theme(Mode ::Light )
19- when / dark/i
19+ when . dark?
2020 # 🌚 🌑
2121 puts(" 🌑 setting #{ Mode ::Dark .theme} " ) if @verbose
2222 ThemeController .set_theme(Mode ::Dark )
23- else
24- puts(" 💀 unexpected theme #{ current_theme } " ) if @verbose
25- end
26- end
27-
28- def current_theme : String
29- style = Croft ::UserDefaults .standard_user_defaults[Croft ::String .new(" AppleInterfaceStyle" )].to_s
30-
31- if style.empty?
32- " Light"
33- else
34- " Dark"
3523 end
3624 end
3725end
Original file line number Diff line number Diff line change 1+ require " croft"
2+
13DEFAULT_DARK_THEME = " gruvbox-dark-hard"
24DEFAULT_LIGHT_THEME = " one-light"
35
@@ -11,4 +13,14 @@ enum Mode
1113 when .light? then ENV .fetch(" LIGHTDARK_LIGHT_THEME" , DEFAULT_LIGHT_THEME )
1214 end
1315 end
16+
17+ def self.current : Mode
18+ style = Croft ::UserDefaults .standard_user_defaults[Croft ::String .new(" AppleInterfaceStyle" )].to_s
19+
20+ if style.empty?
21+ Light
22+ else
23+ Dark
24+ end
25+ end
1426end
You can’t perform that action at this time.
0 commit comments