mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
Updating group icon style for newer macOS (#3065)
This commit is contained in:
parent
7ab2fbfbd6
commit
67f6562ae4
1 changed files with 13 additions and 15 deletions
|
@ -67,25 +67,25 @@ GroupsController* fGroupsInstance = nil;
|
|||
{
|
||||
//default groups
|
||||
NSMutableDictionary* red = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.redColor, @"Color", NSLocalizedString(@"Red", "Groups -> Name"), @"Name", @0, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemRedColor, @"Color", NSLocalizedString(@"Red", "Groups -> Name"), @"Name", @0, @"Index", nil];
|
||||
|
||||
NSMutableDictionary* orange = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.orangeColor, @"Color", NSLocalizedString(@"Orange", "Groups -> Name"), @"Name", @1, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemOrangeColor, @"Color", NSLocalizedString(@"Orange", "Groups -> Name"), @"Name", @1, @"Index", nil];
|
||||
|
||||
NSMutableDictionary* yellow = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.yellowColor, @"Color", NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name", @2, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemYellowColor, @"Color", NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name", @2, @"Index", nil];
|
||||
|
||||
NSMutableDictionary* green = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.greenColor, @"Color", NSLocalizedString(@"Green", "Groups -> Name"), @"Name", @3, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemGreenColor, @"Color", NSLocalizedString(@"Green", "Groups -> Name"), @"Name", @3, @"Index", nil];
|
||||
|
||||
NSMutableDictionary* blue = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.blueColor, @"Color", NSLocalizedString(@"Blue", "Groups -> Name"), @"Name", @4, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemBlueColor, @"Color", NSLocalizedString(@"Blue", "Groups -> Name"), @"Name", @4, @"Index", nil];
|
||||
|
||||
NSMutableDictionary* purple = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.purpleColor, @"Color", NSLocalizedString(@"Purple", "Groups -> Name"), @"Name", @5, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemPurpleColor, @"Color", NSLocalizedString(@"Purple", "Groups -> Name"), @"Name", @5, @"Index", nil];
|
||||
|
||||
NSMutableDictionary* gray = [NSMutableDictionary
|
||||
dictionaryWithObjectsAndKeys:NSColor.grayColor, @"Color", NSLocalizedString(@"Gray", "Groups -> Name"), @"Name", @6, @"Index", nil];
|
||||
dictionaryWithObjectsAndKeys:NSColor.systemGrayColor, @"Color", NSLocalizedString(@"Gray", "Groups -> Name"), @"Name", @6, @"Index", nil];
|
||||
|
||||
_fGroups = [[NSMutableArray alloc] initWithObjects:red, orange, yellow, green, blue, purple, gray, nil];
|
||||
[self saveGroups]; //make sure this is saved right away
|
||||
|
@ -377,25 +377,23 @@ GroupsController* fGroupsInstance = nil;
|
|||
return image;
|
||||
}
|
||||
|
||||
NSColor* color = dict[@"Color"];
|
||||
|
||||
NSRect rect = NSMakeRect(0.0, 0.0, ICON_WIDTH, ICON_WIDTH);
|
||||
|
||||
NSBezierPath* bp = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:3.0 yRadius:3.0];
|
||||
NSImage* icon = [[NSImage alloc] initWithSize:rect.size];
|
||||
|
||||
NSColor* color = dict[@"Color"];
|
||||
|
||||
[icon lockFocus];
|
||||
|
||||
//border
|
||||
NSBezierPath* bp = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:rect.size.width / 2 yRadius:rect.size.width / 2];
|
||||
NSGradient* gradient = [[NSGradient alloc] initWithStartingColor:[color blendedColorWithFraction:0.45 ofColor:NSColor.whiteColor]
|
||||
endingColor:color];
|
||||
[gradient drawInBezierPath:bp angle:270.0];
|
||||
[gradient drawInBezierPath:bp angle:0.0];
|
||||
|
||||
//inside
|
||||
bp = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(rect, 1.0, 1.0) xRadius:3.0 yRadius:3.0];
|
||||
gradient = [[NSGradient alloc] initWithStartingColor:[color blendedColorWithFraction:0.75 ofColor:NSColor.whiteColor]
|
||||
endingColor:[color blendedColorWithFraction:0.2 ofColor:NSColor.whiteColor]];
|
||||
[gradient drawInBezierPath:bp angle:270.0];
|
||||
[color setFill];
|
||||
[bp fill];
|
||||
|
||||
[icon unlockFocus];
|
||||
|
||||
|
|
Loading…
Reference in a new issue