Mercurial > minori
diff src/sys/osx/dark_theme.mm @ 9:5c0397762b53
INCOMPLETE: megacommit :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 10 Sep 2023 03:59:16 -0400 |
parents | 51ae25154b70 |
children | cde8f67a7c7d |
line wrap: on
line diff
--- a/src/sys/osx/dark_theme.mm Sat Aug 26 03:39:34 2023 -0400 +++ b/src/sys/osx/dark_theme.mm Sun Sep 10 03:59:16 2023 -0400 @@ -1,47 +1,46 @@ #include "sys/osx/dark_theme.h" #import <Cocoa/Cocoa.h> -bool osx::DarkThemeAvailable() -{ +namespace osx { + +bool DarkThemeAvailable() { if (@available(macOS 10.14, *)) return true; else return false; } -bool osx::IsInDarkTheme() -{ - if (@available(macOS 10.14, *)) - { - auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames: - @[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]]; - return [appearance isEqualToString:NSAppearanceNameDarkAqua]; - } - return false; +bool IsInDarkTheme() { + if (@available(macOS 10.14, *)) { + auto appearance = + [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames:@[ + NSAppearanceNameAqua, NSAppearanceNameDarkAqua + ]]; + return [appearance isEqualToString:NSAppearanceNameDarkAqua]; + } + return false; } -void osx::SetToDarkTheme() -{ - // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code - if (@available(macOS 10.14, *)) - { - [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]]; - } +void SetToDarkTheme() { + // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code + if (@available(macOS 10.14, *)) { + [NSApp setAppearance:[NSAppearance + appearanceNamed:NSAppearanceNameDarkAqua]]; + } } -void osx::SetToLightTheme() -{ - // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code - if (__builtin_available(macOS 10.14, *)) - { - [NSApp setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; - } +void SetToLightTheme() { + // https://stackoverflow.com/questions/55925862/how-can-i-set-my-os-x-application-theme-in-code + if (__builtin_available(macOS 10.14, *)) { + [NSApp + setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; + } } -void osx::SetToAutoTheme() -{ - if (@available(macOS 10.14, *)) - { - [NSApp setAppearance:nil]; - } +void SetToAutoTheme() { + if (@available(macOS 10.14, *)) { + [NSApp setAppearance:nil]; + } } + +} // namespace osx