Skip to content

Commit

Permalink
Make the tab color draw over the top line of a horizontal tab bar. Lo…
Browse files Browse the repository at this point in the history
…oks better. Alpha out tab colors a bit for non-key windows to help make it clearer which window is key.
  • Loading branch information
gnachman committed Jun 1, 2016
1 parent 1bab182 commit d831219
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ThirdParty/PSMTabBarControl/source/PSMYosemiteTabStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,18 @@ - (void)drawCellBackgroundAndFrameHorizontallyOriented:(BOOL)horizontal
NSRectFill(cellFrame);

if (tabColor) {
if (horizontal) {
// Draw the tab color over the top line. Looks better.
cellFrame.size.height += 1;
cellFrame.origin.y -= 1;
}

// Alpha the non-key window's tab colors a bit to make it clearer which window is key.
const CGFloat alpha = [_tabBar.window isKeyWindow] ? 0.8 : 0.5;
[[tabColor colorWithAlphaComponent:alpha] set];
if (selected) {
[[tabColor colorWithAlphaComponent:0.8] set];
NSRectFillUsingOperation(cellFrame, NSCompositeSourceOver);
} else {
[[tabColor colorWithAlphaComponent:0.8] set];
NSRect colorRect = cellFrame;

CGRect unscaledRect = CGRectMake(0, 0, 1, 1);
Expand All @@ -457,7 +464,6 @@ - (void)drawCellBackgroundAndFrameHorizontallyOriented:(BOOL)horizontal
} else {
colorRect.size.width = 6;
}
[[tabColor colorWithAlphaComponent:0.8] set];
NSRectFillUsingOperation(colorRect, NSCompositeSourceOver);

[[self topLineColorSelected:selected] set];
Expand Down

0 comments on commit d831219

Please sign in to comment.