|
@@ -62,6 +62,7 @@
|
62
|
62
|
#define MENU_ITEM_TAG_NOTHING -1
|
63
|
63
|
#define MENU_ITEM_TAG_AUDIO -2
|
64
|
64
|
|
|
65
|
+// Define this to color the status bar icon according to the current RGB LED value
|
65
|
66
|
#define COLORED_MENU_BAR_ICON
|
66
|
67
|
|
67
|
68
|
@interface AppDelegate ()
|
|
@@ -116,12 +117,27 @@
|
116
|
117
|
NSRect imageBounds = NSMakeRect(0, 0, size.width, size.height);
|
117
|
118
|
|
118
|
119
|
NSImage *copiedImage = [image copy];
|
|
120
|
+ NSColor *copiedTint = [tint copy];
|
|
121
|
+
|
|
122
|
+ // Fix colors for different interface styles
|
|
123
|
+ NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
|
|
124
|
+ CGFloat r, g, b, a;
|
|
125
|
+ [copiedTint getRed:&r green:&g blue:&b alpha:&a];
|
|
126
|
+ if ((osxMode != nil) && ([osxMode isEqualToString:@"Dark"])) {
|
|
127
|
+ // Dark mode
|
|
128
|
+ if ((r < 0.001f) && (g < 0.001f) && (b < 0.001f)) {
|
|
129
|
+ copiedTint = [NSColor whiteColor];
|
|
130
|
+ }
|
|
131
|
+ } else {
|
|
132
|
+ // Normal mode
|
|
133
|
+ if ((r > 0.999f) && (g > 0.999f) && (b > 0.999f)) {
|
|
134
|
+ copiedTint = [NSColor blackColor];
|
|
135
|
+ }
|
|
136
|
+ }
|
119
|
137
|
|
120
|
138
|
[copiedImage lockFocus];
|
121
|
|
-
|
122
|
|
- [tint set];
|
|
139
|
+ [copiedTint set];
|
123
|
140
|
NSRectFillUsingOperation(imageBounds, NSCompositeSourceAtop);
|
124
|
|
-
|
125
|
141
|
[copiedImage unlockFocus];
|
126
|
142
|
|
127
|
143
|
return copiedImage;
|
|
@@ -141,7 +157,7 @@
|
141
|
157
|
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
142
|
158
|
#ifdef COLORED_MENU_BAR_ICON
|
143
|
159
|
[statusImage setTemplate:NO];
|
144
|
|
- [statusItem setImage:[AppDelegate tintedImage:statusImage WithColor:[NSColor blackColor]]];
|
|
160
|
+ [statusItem setImage:[AppDelegate tintedImage:statusImage WithColor:[NSColor colorWithCalibratedRed:0.0f green:0.0f blue:0.0f alpha:1.0f]]];
|
145
|
161
|
#else
|
146
|
162
|
[statusImage setTemplate:YES];
|
147
|
163
|
[statusItem setImage:statusImage];
|