Revision: 13750
http://sourceforge.net/p/skim-app/code/13750
Author: hofman
Date: 2023-11-12 17:33:28 +0000 (Sun, 12 Nov 2023)
Log Message:
-----------
Use NSWorkSpace rather than appearance to check for high contrast
Modified Paths:
--------------
trunk/NSGraphics_SKExtensions.m
Modified: trunk/NSGraphics_SKExtensions.m
===================================================================
--- trunk/NSGraphics_SKExtensions.m 2023-11-12 17:11:21 UTC (rev 13749)
+++ trunk/NSGraphics_SKExtensions.m 2023-11-12 17:33:28 UTC (rev 13750)
@@ -54,7 +54,6 @@
@end
#define NSAppearanceNameDarkAqua @"NSAppearanceNameDarkAqua"
-#define NSAppearanceNameAccessibilityHighContrastDarkAqua
@"NSAppearanceNameAccessibilityDarkAqua"
#endif
@@ -70,18 +69,6 @@
return NO;
}
-BOOL SKHasHighContrastDarkAppearance(id object) {
- if (@available(macOS 10.14, *)) {
- id appearance = nil;
- if (object == nil)
- appearance = [NSAppearance currentAppearance];
- else if ([object respondsToSelector:@selector(effectiveAppearance)])
- appearance = [(id<NSAppearanceCustomization>)object
effectiveAppearance];
- return [[appearance
bestMatchFromAppearancesWithNames:@[NSAppearanceNameDarkAqua,
NSAppearanceNameAccessibilityHighContrastDarkAqua]]
isEqualToString:NSAppearanceNameAccessibilityHighContrastDarkAqua];
- }
- return NO;
-}
-
void SKSetHasDarkAppearance(id object) {
if (@available(macOS 10.14, *)) {
if ([object respondsToSelector:@selector(setAppearance:)])
@@ -223,7 +210,7 @@
}
if (SKHasDarkAppearance(NSApp) && [[NSUserDefaults standardUserDefaults]
boolForKey:SKInvertColorsInDarkModeKey]) {
// map the white page background to 45/255, or 30/255 with high
contrast
- CGFloat f = SKHasHighContrastDarkAppearance(NSApp) ? 1.9337 : 1.8972;
+ CGFloat f = [[NSWorkspace sharedWorkspace]
accessibilityDisplayShouldIncreaseContrast] ? 1.9337 : 1.8972;
// This is like CIColorInvert + CIHueAdjust, modified to map white to
dark gray rather than black
// Inverts a linear luminocity with weights from the CIE standards
// see
https://wiki.preterhuman.net/Matrix_Operations_for_Image_Processingand
https://beesbuzz.biz/code/16-hsv-color-transforms
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit