diff --git a/FreenetTray/Base.lproj/FNSettingsWindow.xib b/FreenetTray/Base.lproj/FNSettingsWindow.xib
index 98c7104..1cd406e 100644
--- a/FreenetTray/Base.lproj/FNSettingsWindow.xib
+++ b/FreenetTray/Base.lproj/FNSettingsWindow.xib
@@ -20,14 +20,14 @@
-
-
+
+
-
+
diff --git a/FreenetTray/FNSettingsWindowController.h b/FreenetTray/FNSettingsWindowController.h
index 6ece36a..38cb4b5 100644
--- a/FreenetTray/FNSettingsWindowController.h
+++ b/FreenetTray/FNSettingsWindowController.h
@@ -32,4 +32,6 @@
-(IBAction)uninstallFreenet:(id)sender;
+-(IBAction)changeTrayIconColor:(id)sender;
+
@end
diff --git a/FreenetTray/FNSettingsWindowController.m b/FreenetTray/FNSettingsWindowController.m
index 403ce41..60622a2 100644
--- a/FreenetTray/FNSettingsWindowController.m
+++ b/FreenetTray/FNSettingsWindowController.m
@@ -18,6 +18,8 @@
#import "FNNodeController.h"
+#import "TrayIcon.h"
+
@interface FNSettingsWindowController ()
@end
@@ -96,6 +98,10 @@ -(IBAction)selectNodeLocation:(id)sender {
}
+-(IBAction)changeTrayIconColor:(id)sender {
+ [TrayIcon refreshColors];
+}
+
-(IBAction)uninstallFreenet:(id)sender {
[FNHelpers displayUninstallAlert];
}
diff --git a/FreenetTray/TrayIcon.h b/FreenetTray/TrayIcon.h
index ffb6b5e..406a417 100644
--- a/FreenetTray/TrayIcon.h
+++ b/FreenetTray/TrayIcon.h
@@ -19,6 +19,7 @@
+ (void)drawRunningIcon;
+ (void)drawNotRunningIcon;
+ (void)drawHighlightedIcon;
++ (void)refreshColors;
// Generated Images
+ (NSImage*)imageOfRunningIcon;
diff --git a/FreenetTray/TrayIcon.m b/FreenetTray/TrayIcon.m
index 4503a23..6b984eb 100644
--- a/FreenetTray/TrayIcon.m
+++ b/FreenetTray/TrayIcon.m
@@ -13,6 +13,17 @@
#import "TrayIcon.h"
+@interface TrayIcon ()
+
+// color getter
++ (NSColor *)runningIconColor;
++ (NSColor *)notRunningIconColor;
++ (NSColor *)highlightedIconColor;
+
+@end
+
+
+
@implementation TrayIcon
#pragma mark Cache
@@ -21,16 +32,57 @@ @implementation TrayIcon
static NSImage* _imageOfNotRunningIcon = nil;
static NSImage* _imageOfHighlightedIcon = nil;
+static NSColor* _runningColor = nil;
+static NSColor* _notRunningColor = nil;
+static NSColor* _highlightedColor = nil;
+
+
#pragma mark Initialization
+ (void)initialize {
+ [TrayIcon refreshColors];
+}
+
+#pragma mark Tray colors
+
++ (void)refreshColors {
+
+ _imageOfRunningIcon = nil;
+ _imageOfNotRunningIcon = nil;
+ _imageOfHighlightedIcon = nil;
+
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+ _runningColor = [defaults boolForKey:@"grayscaleIcon"]
+ ? [NSColor colorWithCalibratedRed: 1. green:1. blue: 1. alpha: 1.]
+ : [NSColor colorWithCalibratedRed: 0.161 green: 0.322 blue: 0.765 alpha: 1.];
+
+ _notRunningColor = [defaults boolForKey:@"grayscaleIcon"]
+ ? [NSColor colorWithCalibratedRed: 0.337 green: 0.337 blue: 0.337 alpha: 1]
+ : [NSColor colorWithCalibratedRed: 1. green: 0. blue: 0. alpha: 1.];
+
+ _highlightedColor = [defaults boolForKey:@"grayscaleIcon"]
+ ? [NSColor colorWithCalibratedRed: 0.663 green: 0.663 blue: 0.663 alpha: 1]
+ : [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 1];
+}
+
++ (NSColor *)runningIconColor {
+ return _runningColor;
+}
+
++ (NSColor *)notRunningIconColor {
+ return _notRunningColor;
+}
+
++ (NSColor *)highlightedIconColor {
+ return _highlightedColor;
}
#pragma mark Drawing Methods
+ (void)drawRunningIcon {
//// Color Declarations
- NSColor* run = [NSColor colorWithCalibratedRed: 0.161 green: 0.322 blue: 0.765 alpha: 1];
+ NSColor* run = [TrayIcon runningIconColor];
//// Group
{
@@ -64,7 +116,7 @@ + (void)drawRunningIcon {
+ (void)drawNotRunningIcon {
//// Color Declarations
- NSColor* stop = [NSColor colorWithCalibratedRed: 1 green: 0 blue: 0 alpha: 1];
+ NSColor* stop = [TrayIcon notRunningIconColor];
//// Group
{
@@ -98,7 +150,7 @@ + (void)drawNotRunningIcon {
+ (void)drawHighlightedIcon {
//// Color Declarations
- NSColor* highlight = [NSColor colorWithCalibratedRed: 1 green: 1 blue: 1 alpha: 1];
+ NSColor* highlight = [TrayIcon highlightedIconColor];
//// Group
{
diff --git a/FreenetTray/defaults.plist b/FreenetTray/defaults.plist
index 939a3d3..39d2b36 100644
--- a/FreenetTray/defaults.plist
+++ b/FreenetTray/defaults.plist
@@ -12,5 +12,7 @@
firstlaunch
+ grayscaleIcon
+