Skip to content
Snippets Groups Projects
Commit be33d4c8 authored by George Nachman's avatar George Nachman
Browse files

Make tab labels black and white when any tab has color. Make the outline...

Make tab labels black and white when any tab has color. Make the outline always stark white (with very dark tabs it ended up the same color as the tab bar lines). Make uncolored tabs have a white outline.
parent 609f66f7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -351,7 +351,7 @@
 
- (NSColor *)textColorForCell:(PSMTabBarCell *)cell {
NSColor *textColor;
if (cell.state == NSOnState) {
if (cell.state == NSOnState || [self anyTabHasColor]) {
if (!cell.tabColor) {
return [self textColorDefaultSelected:YES];
} else if ([cell.tabColor brightnessComponent] > 0.2) {
Loading
Loading
@@ -540,7 +540,10 @@ static CGFloat PerceivedBrightness(CGFloat r, CGFloat g, CGFloat b) {
}
 
- (CGFloat)tabColorBrightness:(PSMTabBarCell *)cell {
NSColor *tabColor = cell.tabColor ?: [self backgroundColorSelected:cell.state == NSOnState highlightAmount:0];
if (!cell.tabColor) {
return 0.7;
}
NSColor *tabColor = cell.tabColor;
NSColor *safeColor = [tabColor colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
CGFloat brightness = PerceivedBrightness([safeColor redComponent],
[safeColor greenComponent],
Loading
Loading
@@ -548,11 +551,14 @@ static CGFloat PerceivedBrightness(CGFloat r, CGFloat g, CGFloat b) {
return brightness;
}
 
- (void)drawPostHocDecorationsOnSelectedCell:(PSMTabBarCell *)cell {
const BOOL anyTabHasColor = [_tabBar.cells indexOfObjectPassingTest:^BOOL(PSMTabBarCell * _Nonnull cell, NSUInteger idx, BOOL * _Nonnull stop) {
- (BOOL)anyTabHasColor {
return [_tabBar.cells indexOfObjectPassingTest:^BOOL(PSMTabBarCell * _Nonnull cell, NSUInteger idx, BOOL * _Nonnull stop) {
return cell.tabColor != nil;
}] != NSNotFound;
if (anyTabHasColor) {
}
- (void)drawPostHocDecorationsOnSelectedCell:(PSMTabBarCell *)cell {
if (self.anyTabHasColor) {
const CGFloat brightness = [self tabColorBrightness:cell];
[[NSColor colorWithWhite:MIN(1, brightness + 0.6) alpha:1] set];
NSFrameRect(cell.frame);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment