Skip to content

Commit da2a243

Browse files
committed
Refine tabline appearance and coloring
1 parent edfa886 commit da2a243

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

src/MacVim/MMTabline/MMHoverButton.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ - (instancetype)initWithFrame:(NSRect)frameRect
1818
_circle = [NSBox new];
1919
_circle.boxType = NSBoxCustom;
2020
_circle.borderWidth = 0;
21-
_circle.alphaValue = 0.12;
21+
_circle.alphaValue = 0.16;
2222
_circle.fillColor = NSColor.clearColor;
2323
_circle.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
2424
_circle.frame = self.bounds;
@@ -44,7 +44,7 @@ - (void)setImage:(NSImage *)image
4444
return YES;
4545
}];
4646
self.alternateImage = [NSImage imageWithSize:image.size flipped:NO drawingHandler:^BOOL(NSRect dstRect) {
47-
[[fillColor colorWithAlphaComponent:0.15] set];
47+
[[fillColor colorWithAlphaComponent:0.2] set];
4848
[[NSBezierPath bezierPathWithOvalInRect:dstRect] fill];
4949
[super.image drawInRect:dstRect];
5050
return YES;

src/MacVim/MMTabline/MMTab.m

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ - (instancetype)initWithFrame:(NSRect)frameRect tabline:(MMTabline *)tabline
5252
[self addSubview:_titleLabel];
5353

5454
NSDictionary *viewDict = NSDictionaryOfVariableBindings(_closeButton, _titleLabel);
55-
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-7-[_closeButton]-(>=5)-[_titleLabel]-(>=8)-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:viewDict]];
56-
[self addConstraint:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:_titleLabel attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];
55+
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-9-[_closeButton]-(>=5)-[_titleLabel]-(>=16)-|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:viewDict]];
56+
[self addConstraint:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:_titleLabel attribute:NSLayoutAttributeCenterY multiplier:1 constant:-2]];
5757
NSLayoutConstraint *centerConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:_titleLabel attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];
5858
centerConstraint.priority = NSLayoutPriorityFittingSizeCompression+1;
5959
[self addConstraint:centerConstraint];
@@ -101,7 +101,6 @@ - (void)setState:(MMTabState)state
101101
if (state == MMTabStateSelected) {
102102
_closeButton.alphaValue = 1;
103103
_titleLabel.textColor = _tabline.tablineSelFgColor ?: NSColor.controlTextColor;
104-
_titleLabel.font = [NSFont systemFontOfSize:11 weight:NSFontWeightMedium];
105104
self.fillColor = _tabline.tablineSelBgColor ?: [NSColor colorNamed:@"TablineSel"];
106105
self.shadow = _shadow;
107106
}
@@ -115,13 +114,11 @@ - (void)setState:(MMTabState)state
115114
_titleLabel.animator.textColor = _tabline.tablineFgColor ?: NSColor.disabledControlTextColor;
116115
self.animator.fillColor = _tabline.tablineBgColor ?: [NSColor colorNamed:@"Tabline"];
117116
}
118-
_titleLabel.font = [NSFont systemFontOfSize:11];
119117
self.shadow = nil;
120118
}
121119
else { // state == MMTabStateUnselectedHover
122120
_closeButton.animator.alphaValue = 1;
123121
_titleLabel.animator.textColor = _tabline.tablineSelFgColor ?: NSColor.controlTextColor;
124-
_titleLabel.font = [NSFont systemFontOfSize:11];
125122
self.animator.fillColor = self.unselectedHoverColor;
126123
self.animator.shadow = _shadow;
127124
}
@@ -144,13 +141,14 @@ - (NSColor *)unselectedHoverColor
144141
- (void)drawRect:(NSRect)dirtyRect
145142
{
146143
[self.fillColor set];
144+
CGFloat maxX = NSMaxX(self.bounds);
147145
NSBezierPath *p = [NSBezierPath new];
148146
[p moveToPoint:NSZeroPoint];
149-
[p lineToPoint:NSMakePoint(3.6, NSMaxY(self.bounds) - 2.5)];
150-
[p curveToPoint:NSMakePoint(6.5, NSMaxY(self.bounds)) controlPoint1:NSMakePoint(3.8, NSMaxY(self.bounds) - 1) controlPoint2:NSMakePoint(5.1, NSMaxY(self.bounds))];
151-
[p lineToPoint:NSMakePoint(NSMaxX(self.bounds) - 6.5, NSMaxY(self.bounds))];
152-
[p curveToPoint:NSMakePoint(NSMaxX(self.bounds) - 3.6, NSMaxY(self.bounds) - 2.5) controlPoint1:NSMakePoint(NSMaxX(self.bounds) - 5.1, NSMaxY(self.bounds)) controlPoint2:NSMakePoint(NSMaxX(self.bounds) - 3.8, NSMaxY(self.bounds) - 1)];
153-
[p lineToPoint:NSMakePoint(NSMaxX(self.bounds), 0)];
147+
[p lineToPoint:NSMakePoint(5.41, 20.76)];
148+
[p curveToPoint:NSMakePoint(8.32, 23) controlPoint1: NSMakePoint(5.76, 22.08) controlPoint2: NSMakePoint(6.95, 23)];
149+
[p lineToPoint:NSMakePoint(maxX - 8.32, 23)];
150+
[p curveToPoint: NSMakePoint(maxX - 5.41, 20.76) controlPoint1: NSMakePoint(maxX - 6.95, 23) controlPoint2: NSMakePoint(maxX - 5.76, 22.08)];
151+
[p lineToPoint:NSMakePoint(maxX, 0)];
154152
[p closePath];
155153
[p fill];
156154
}

src/MacVim/MMTabline/MMTabline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// A tabline containing one or more tabs.
66

7-
#define MMTablineHeight (23)
7+
#define MMTablineHeight (27)
88

99
@protocol MMTablineDelegate;
1010

src/MacVim/MMTabline/MMTabline.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
const CGFloat OptimumTabWidth = 200;
1010
const CGFloat MinimumTabWidth = 100;
11-
const CGFloat TabOverlap = 2;
11+
const CGFloat TabOverlap = 4;
1212

1313
@implementation MMTabline
1414
{

src/MacVim/MMVimView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ - (void)setTablineColorsBasedOnBackground:(NSColor *)back foreground:(NSColor *)
478478
b2 = (b > 0.5) ? b - 0.15 : b + 0.15;
479479
tabline.tablineBgColor = [NSColor colorWithHue:h saturation:s brightness:b2 alpha:a];
480480

481-
b3 = (b > 0.5) ? b - 0.25 : b + 0.25;
481+
b3 = (b > 0.5) ? b - 0.30 : b + 0.30;
482482
tabline.tablineFillFgColor = [NSColor colorWithHue:h saturation:s brightness:b3 alpha:a];
483483

484484
[fore getHue:&h saturation:&s brightness:&b alpha:&a];

0 commit comments

Comments
 (0)