Mercurial > minori
comparison src/sys/osx/dark_theme.mm @ 105:6d8da6e64d61
theme: add dark stylesheet, make it actually usable
win32: make the titlebar black where available
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 03:54:26 -0500 |
parents | cde8f67a7c7d |
children | 9c4645100fec |
comparison
equal
deleted
inserted
replaced
104:27455104ea37 | 105:6d8da6e64d61 |
---|---|
1 #include "sys/osx/dark_theme.h" | 1 #include "sys/osx/dark_theme.h" |
2 #import <Cocoa/Cocoa.h> | 2 #import <Cocoa/Cocoa.h> |
3 | 3 |
4 namespace osx { | 4 namespace osx { |
5 | 5 |
6 /* I remember clang giving a hissy fit when I tried simplifying this to just | |
7 a return; does it still do that? */ | |
6 bool DarkThemeAvailable() { | 8 bool DarkThemeAvailable() { |
7 if (@available(macOS 10.14, *)) | 9 if (@available(macOS 10.14, *)) |
8 return true; | 10 return true; |
9 else | 11 else |
10 return false; | 12 return false; |
26 } | 28 } |
27 } | 29 } |
28 | 30 |
29 void SetToLightTheme() { | 31 void SetToLightTheme() { |
30 // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code | 32 // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code |
31 if (__builtin_available(macOS 10.14, *)) { | 33 if (@available(macOS 10.14, *)) { |
32 [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; | 34 [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; |
33 } | 35 } |
34 } | 36 } |
35 | 37 |
36 void SetToAutoTheme() { | 38 void SetToAutoTheme() { |