Skip to content

Commit

Permalink
Fix colors in dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tlunter committed Apr 17, 2015
1 parent e3860b2 commit bc4c31b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Amtrak Status.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
3A1B2A8019832EF900EB2C05 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A1B2A7F19832EF900EB2C05 /* MainMenu.xib */; };
3A1B2AC519833D0600EB2C05 /* TLAmtrakStatusView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A1B2AC419833D0600EB2C05 /* TLAmtrakStatusView.m */; };
3A1DD09219A7F98A004C038C /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A1DD09119A7F98A004C038C /* Sparkle.framework */; };
3A1DD09419A7FB26004C038C /* Sparkle.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = 3A1DD09119A7F98A004C038C /* Sparkle.framework */; };
3A1DD09419A7FB26004C038C /* Sparkle.framework in Copy Files */ = {isa = PBXBuildFile; fileRef = 3A1DD09119A7F98A004C038C /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
3A1DD09619A80318004C038C /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 3A1DD09519A80318004C038C /* dsa_pub.pem */; };
3A1DD0E519A81DEA004C038C /* AmtrakStatusHelper.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3A1DD0DF19A81D62004C038C /* AmtrakStatusHelper.app */; };
3A1DD0E619A81E3D004C038C /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A1DD09719A81901004C038C /* ServiceManagement.framework */; };
Expand Down Expand Up @@ -536,7 +536,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = TL;
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0630;
ORGANIZATIONNAME = "___FULLUSERNAME___";
TargetAttributes = {
3AC026C51981AE9700AEDAE9 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -58,7 +58,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC026A41981AE9700AEDAE9"
Expand All @@ -76,7 +77,8 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC026A41981AE9700AEDAE9"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -58,7 +58,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC026A41981AE9700AEDAE9"
Expand All @@ -76,7 +77,8 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3AC026A41981AE9700AEDAE9"
Expand Down
1 change: 1 addition & 0 deletions Amtrak Status/TLAmtrakStatusView/TLAmtrakStatusView.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

+ (NSInteger)rowHeight;
- (void)setTrainData:(NSArray *)trainData;
- (void)updateView;

@property TLTrain *header;
@property NSArray *trains;
Expand Down
15 changes: 10 additions & 5 deletions Amtrak Status/TLAmtrakStatusView/TLAmtrakStatusView.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,24 @@ - (void)updateView {

for (int i = 0; i < max; i++) {
TLTrain *train = [trains objectAtIndex:i];
NSColor *color;
NSColor *backgroundColor;
if ([preferredTrain isEqualToString:train.number]) {
color = [NSColor selectedTextBackgroundColor];
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if ([@"dark" caseInsensitiveCompare:osxMode] == NSOrderedSame) {
backgroundColor = [NSColor tertiaryLabelColor];
} else {
backgroundColor = [NSColor selectedTextBackgroundColor];
}
} else {
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:[TLOperatingSystemVersion yosemite]]) {
color = [NSColor clearColor];
backgroundColor = [NSColor clearColor];
} else {
color = [[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:(i + 1) % 2];
backgroundColor = [[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:(i + 1) % 2];
}
}
TLTrainListItemView *tLIV = [[TLTrainListItemView alloc] initWithIndex:(max - i - 1)
andTrain:train
andColor:color];
andColor:backgroundColor];
[view addSubview:tLIV];
}

Expand Down
11 changes: 10 additions & 1 deletion Amtrak Status/TLAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,20 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
[amtrakStatusGrabber setFrom:
[[NSUserDefaults standardUserDefaults] objectForKey:@"from"]];

[[NSDistributedNotificationCenter defaultCenter]
addObserver: self selector:@selector(themeChanged:)
name: @"AppleInterfaceThemeChangedNotification" object:nil];

[self buildMenu];

[self startGrabber];
}

- (void)themeChanged:(NSNotification*)notif {
NSLog(@"Theme changed");
[self.amtrakStatusView updateView];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
NSLog(@"Updating defaults");
if ([keyPath isEqualToString:@"from"]) {
Expand Down Expand Up @@ -135,4 +144,4 @@ - (void)runGrabber {
[NSThread detachNewThreadSelector:@selector(getAmtrakStatus) toTarget:amtrakStatusGrabber withObject:nil];
}

@end
@end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -58,7 +58,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3A1DD0A119A81D60004C038C"
Expand All @@ -76,7 +77,8 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3A1DD0A119A81D60004C038C"
Expand Down

0 comments on commit bc4c31b

Please sign in to comment.