Mercurial > minori
annotate src/sys/osx/dark_theme.mm @ 118:39521c47c7a3
*: another huge megacommit, SORRY
The torrents page works a lot better now
Added the edit option to the anime list right click menu
Vectorized currently playing files
Available player and extensions are now loaded at runtime
from files in (dotpath)/players.json and (dotpath)/extensions.json
These paths are not permanent and will likely be moved to
(dotpath)/recognition
...
...
...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 07 Nov 2023 23:40:54 -0500 |
parents | 6d8da6e64d61 |
children | 9c4645100fec |
rev | line source |
---|---|
2 | 1 #include "sys/osx/dark_theme.h" |
2 #import <Cocoa/Cocoa.h> | |
3 | |
9 | 4 namespace osx { |
5 | |
105
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
6 /* I remember clang giving a hissy fit when I tried simplifying this to just |
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
7 a return; does it still do that? */ |
9 | 8 bool DarkThemeAvailable() { |
5 | 9 if (@available(macOS 10.14, *)) |
10 return true; | |
11 else | |
12 return false; | |
2 | 13 } |
14 | |
9 | 15 bool IsInDarkTheme() { |
16 if (@available(macOS 10.14, *)) { | |
15 | 17 auto appearance = [NSApp.effectiveAppearance |
18 bestMatchFromAppearancesWithNames:@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]]; | |
9 | 19 return [appearance isEqualToString:NSAppearanceNameDarkAqua]; |
20 } | |
21 return false; | |
2 | 22 } |
23 | |
9 | 24 void SetToDarkTheme() { |
25 // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code | |
26 if (@available(macOS 10.14, *)) { | |
15 | 27 [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]]; |
9 | 28 } |
2 | 29 } |
30 | |
9 | 31 void SetToLightTheme() { |
32 // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code | |
105
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
33 if (@available(macOS 10.14, *)) { |
15 | 34 [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; |
9 | 35 } |
2 | 36 } |
37 | |
9 | 38 void SetToAutoTheme() { |
39 if (@available(macOS 10.14, *)) { | |
40 [NSApp setAppearance:nil]; | |
41 } | |
2 | 42 } |
9 | 43 |
44 } // namespace osx |