Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nark/WiredClient
Browse files Browse the repository at this point in the history
  • Loading branch information
nark committed Apr 26, 2020
2 parents adb3487 + a368c4e commit 34ac528
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
16 changes: 11 additions & 5 deletions Sources/WCChatController.m
Original file line number Diff line number Diff line change
Expand Up @@ -2612,10 +2612,10 @@ - (NSView *)tableView:(NSTableView *)tableView
} break;
}

if(row != [tableView selectedRow])
//if(row != [tableView selectedRow])
cellView.nickTextField.textColor = [WCUser colorForColor:[user color] idleTint:[user isIdle]];
else
cellView.nickTextField.textColor = [NSColor whiteColor];
//else
// cellView.nickTextField.textColor = [NSColor whiteColor];

[cellView.nickTextField setAllowsEditingTextAttributes:YES];

Expand All @@ -2635,11 +2635,17 @@ - (NSView *)tableView:(NSTableView *)tableView

cellView.nickTextField.attributedStringValue = [NSAttributedString attributedStringWithString:[user nick]
attributes:attributes];

cellView.nickTextField.toolTip = [user nick];

cellView.statusTextField.toolTip = [user status];
cellView.statusTextField.stringValue = [user status];

NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if (osxMode == nil) {
cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1.0]; //Light mode
} else {
cellView.statusTextField.textColor = [NSColor colorWithCalibratedRed:197.0/255.0 green:197.0/255.0 blue:197.0/255.0 alpha:1.0]; //Dark mode
}

cellView.imageView.image = [user iconWithIdleTint:YES];

return cellView;
Expand Down
35 changes: 28 additions & 7 deletions Sources/WCUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,17 @@ @implementation WCUser

+ (NSColor *)colorForColor:(WCAccountColor)color idleTint:(BOOL)idleTint {
NSColor *value;


NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];

switch(color) {
case WCAccountColorBlack:
default:
value = [NSColor colorWithCalibratedHue:0.0 saturation:0.0 brightness:0.0 alpha:1.0];
if (osxMode == nil) {
value = [NSColor colorWithCalibratedHue:0.0 saturation:0.0 brightness:0.0 alpha:1.0]; //Light mode
} else {
value = [NSColor colorWithCalibratedHue:0.0 saturation:0.0 brightness:1.0 alpha:1.0]; //Dark mode
}
break;

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

case WCAccountColorBlue:
value = [NSColor blueColor];
if (osxMode == nil) {
value = [NSColor blueColor]; //Light mode
} else {
value = [NSColor colorWithCalibratedRed:0.5 green:0.5 blue:1.0 alpha:1.0]; //Dark mode
}
break;

case WCAccountColorPurple:
value = [NSColor purpleColor];
if (osxMode == nil) {
value = [NSColor purpleColor]; //Light mode
} else {
value = [NSColor colorWithCalibratedRed:248.0/255.0 green:91.0/255 blue:228.0/255.0 alpha:1.0]; //Dark mode
}
break;
}

Expand Down Expand Up @@ -257,9 +271,16 @@ - (NSImage *)icon {


- (NSImage *)iconWithIdleTint:(BOOL)value {
return _idle && value
? [_icon tintedImageWithColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.5]]
: _icon;
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if (osxMode == nil) {
return _idle && value
? [_icon tintedImageWithColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.5]]
: _icon; //Light mode
} else {
return _idle && value
? [_icon tintedImageWithColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.5]]
: _icon; //Dark mode
}
}


Expand Down

0 comments on commit 34ac528

Please sign in to comment.