From 8dd21f46aa7564bc8a5413967b78561916cc5f97 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Fri, 28 Jan 2022 23:40:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=B1=20Fix=20colors=20for=20dark=20mode?= =?UTF-8?q?=20(#101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IconColorGreen.colorset/Contents.json | 38 +++++++++++++++++++ .../IconColorNormal.colorset/Contents.json | 38 +++++++++++++++++++ .../IconColorRed.colorset/Contents.json | 38 +++++++++++++++++++ phpmon/Domain/Core/Base.lproj/Main.storyboard | 6 ++- phpmon/Domain/Menu/ServicesView.swift | 11 +++--- phpmon/Domain/SiteList/SiteListCell.swift | 4 +- 6 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 phpmon/Assets.xcassets/IconColorGreen.colorset/Contents.json create mode 100644 phpmon/Assets.xcassets/IconColorNormal.colorset/Contents.json create mode 100644 phpmon/Assets.xcassets/IconColorRed.colorset/Contents.json diff --git a/phpmon/Assets.xcassets/IconColorGreen.colorset/Contents.json b/phpmon/Assets.xcassets/IconColorGreen.colorset/Contents.json new file mode 100644 index 0000000..fdb176a --- /dev/null +++ b/phpmon/Assets.xcassets/IconColorGreen.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.501", + "green" : "0.697", + "red" : "0.247" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.501", + "green" : "0.765", + "red" : "0.247" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/phpmon/Assets.xcassets/IconColorNormal.colorset/Contents.json b/phpmon/Assets.xcassets/IconColorNormal.colorset/Contents.json new file mode 100644 index 0000000..d890719 --- /dev/null +++ b/phpmon/Assets.xcassets/IconColorNormal.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000", + "red" : "0.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/phpmon/Assets.xcassets/IconColorRed.colorset/Contents.json b/phpmon/Assets.xcassets/IconColorRed.colorset/Contents.json new file mode 100644 index 0000000..7274621 --- /dev/null +++ b/phpmon/Assets.xcassets/IconColorRed.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.180", + "green" : "0.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.426", + "green" : "0.363", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/phpmon/Domain/Core/Base.lproj/Main.storyboard b/phpmon/Domain/Core/Base.lproj/Main.storyboard index 5b75663..e1c35ad 100644 --- a/phpmon/Domain/Core/Base.lproj/Main.storyboard +++ b/phpmon/Domain/Core/Base.lproj/Main.storyboard @@ -4,6 +4,7 @@ + @@ -690,7 +691,7 @@ Gw - + @@ -784,5 +785,8 @@ Gw + + + diff --git a/phpmon/Domain/Menu/ServicesView.swift b/phpmon/Domain/Menu/ServicesView.swift index 041b01c..d40581d 100644 --- a/phpmon/Domain/Menu/ServicesView.swift +++ b/phpmon/Domain/Menu/ServicesView.swift @@ -21,6 +21,9 @@ class ServicesView: NSView, XibLoadable { static func asMenuItem() -> NSMenuItem { let view = Self.createFromXib()! + [view.imageViewPhp, view.imageViewNginx, view.imageViewDnsmasq].forEach { imageView in + imageView?.contentTintColor = NSColor(named: "IconColorNormal") + } let item = NSMenuItem() item.view = view item.target = self @@ -80,20 +83,18 @@ class ServicesView: NSView, XibLoadable { func applyServiceStyling(_ serviceName: String, _ imageView: NSImageView) { if ServicesView.services[serviceName] == nil { imageView.image = NSImage(named: "ServiceLoading") - imageView.contentTintColor = NSColor.black + imageView.contentTintColor = NSColor(named: "IconColorNormal") return } if ServicesView.services[serviceName]!.running { imageView.image = NSImage(named: "ServiceOn") - imageView.contentTintColor = NSColor.black + imageView.contentTintColor = NSColor(named: "IconColorNormal") return } imageView.image = NSImage(named: "ServiceOff") - imageView.contentTintColor = NSColor.init( - red: 246/255, green: 71/255, blue: 71/255, alpha: 1.0 - ) + imageView.contentTintColor = NSColor(named: "IconColorRed") } deinit { diff --git a/phpmon/Domain/SiteList/SiteListCell.swift b/phpmon/Domain/SiteList/SiteListCell.swift index 3dff456..5e15150 100644 --- a/phpmon/Domain/SiteList/SiteListCell.swift +++ b/phpmon/Domain/SiteList/SiteListCell.swift @@ -49,8 +49,8 @@ class SiteListCell: NSTableCellView // Show the green or red lock based on whether the site was secured // imageViewLock.image = NSImage(named: site.secured ? "Lock" : "LockUnlocked") imageViewLock.contentTintColor = site.secured ? - NSColor.init(red: 63/255, green: 195/255, blue: 128/255, alpha: 1.0) // green - : NSColor.init(red: 246/255, green: 71/255, blue: 71/255, alpha: 1.0) // red + NSColor(named: "IconColorGreen") // green + : NSColor(named: "IconColorRed") // Show the current driver labelDriverType.stringValue = site.driverDeterminedByComposer