Skip to content

Commit a368c4e

Browse files
authored
Merge pull request #106 from ProfDrLuigi/master
Fixes for colors and icon opaque
2 parents 1d2ba44 + 0b87864 commit a368c4e

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

Sources/WCChatController.m

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,10 +2609,10 @@ - (NSView *)tableView:(NSTableView *)tableView
26092609
} break;
26102610
}
26112611

2612-
if(row != [tableView selectedRow])
2612+
//if(row != [tableView selectedRow])
26132613
cellView.nickTextField.textColor = [WCUser colorForColor:[user color] idleTint:[user isIdle]];
2614-
else
2615-
cellView.nickTextField.textColor = [NSColor whiteColor];
2614+
//else
2615+
// cellView.nickTextField.textColor = [NSColor whiteColor];
26162616

26172617
[cellView.nickTextField setAllowsEditingTextAttributes:YES];
26182618

@@ -2632,11 +2632,17 @@ - (NSView *)tableView:(NSTableView *)tableView
26322632

26332633
cellView.nickTextField.attributedStringValue = [NSAttributedString attributedStringWithString:[user nick]
26342634
attributes:attributes];
2635-
26362635
cellView.nickTextField.toolTip = [user nick];
2637-
26382636
cellView.statusTextField.toolTip = [user status];
26392637
cellView.statusTextField.stringValue = [user status];
2638+
2639+
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
2640+
if (osxMode == nil) {
2641+
cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1.0]; //Light mode
2642+
} else {
2643+
cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:197.0/255.0 green:197.0/255.0 blue:197.0/255.0 alpha:1.0]; //Dark mode
2644+
}
2645+
26402646
cellView.imageView.image = [user iconWithIdleTint:YES];
26412647

26422648
return cellView;

Sources/WCUser.m

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,17 @@ @implementation WCUser
9696

9797
+ (NSColor *)colorForColor:(WCAccountColor)color idleTint:(BOOL)idleTint {
9898
NSColor *value;
99-
99+
100+
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
101+
100102
switch(color) {
101103
case WCAccountColorBlack:
102104
default:
103-
value = [NSColor colorWithCalibratedHue:0.0 saturation:0.0 brightness:0.0 alpha:1.0];
105+
if (osxMode == nil) {
106+
value = [NSColor colorWithCalibratedHue:0.0 saturation:0.0 brightness:0.0 alpha:1.0]; //Light mode
107+
} else {
108+
value = [NSColor colorWithCalibratedHue:0.0 saturation:0.0 brightness:1.0 alpha:1.0]; //Dark mode
109+
}
104110
break;
105111

106112
case WCAccountColorRed:
@@ -116,11 +122,19 @@ + (NSColor *)colorForColor:(WCAccountColor)color idleTint:(BOOL)idleTint {
116122
break;
117123

118124
case WCAccountColorBlue:
119-
value = [NSColor blueColor];
125+
if (osxMode == nil) {
126+
value = [NSColor blueColor]; //Light mode
127+
} else {
128+
value = [NSColor colorWithCalibratedRed:0.5 green:0.5 blue:1.0 alpha:1.0]; //Dark mode
129+
}
120130
break;
121131

122132
case WCAccountColorPurple:
123-
value = [NSColor purpleColor];
133+
if (osxMode == nil) {
134+
value = [NSColor purpleColor]; //Light mode
135+
} else {
136+
value = [NSColor colorWithCalibratedRed:248.0/255.0 green:91.0/255 blue:228.0/255.0 alpha:1.0]; //Dark mode
137+
}
124138
break;
125139
}
126140

@@ -257,9 +271,16 @@ - (NSImage *)icon {
257271

258272

259273
- (NSImage *)iconWithIdleTint:(BOOL)value {
260-
return _idle && value
261-
? [_icon tintedImageWithColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.5]]
262-
: _icon;
274+
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
275+
if (osxMode == nil) {
276+
return _idle && value
277+
? [_icon tintedImageWithColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.5]]
278+
: _icon; //Light mode
279+
} else {
280+
return _idle && value
281+
? [_icon tintedImageWithColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.5]]
282+
: _icon; //Dark mode
283+
}
263284
}
264285

265286

0 commit comments

Comments
 (0)