|
2 | 2 |
|
3 | 3 | #import "SquirrelConfig.h"
|
4 | 4 |
|
5 |
| -static const int kOffsetHeight = 5; |
6 |
| -static const int kDefaultFontSize = 24; |
| 5 | +static const CGFloat kOffsetHeight = 5; |
| 6 | +static const CGFloat kDefaultFontSize = 24; |
| 7 | +static const CGFloat kBlendedBackgroundColorFraction = 1.0 / 5; |
7 | 8 | static const NSTimeInterval kShowStatusDuration = 1.2;
|
8 | 9 | static NSString *const kDefaultCandidateFormat = @"%c. %@";
|
9 | 10 |
|
@@ -1109,31 +1110,8 @@ - (void)hideStatus:(NSTimer *)timer {
|
1109 | 1110 | // return foregroundColor;
|
1110 | 1111 | backgroundColor = [NSColor lightGrayColor];
|
1111 | 1112 | }
|
1112 |
| - |
1113 |
| - struct { |
1114 |
| - CGFloat r, g, b, a; |
1115 |
| - } f, b; |
1116 |
| - |
1117 |
| - [[foregroundColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]] |
1118 |
| - getRed:&f.r |
1119 |
| - green:&f.g |
1120 |
| - blue:&f.b |
1121 |
| - alpha:&f.a]; |
1122 |
| - //NSLog(@"fg: %f %f %f %f", f.r, f.g, f.b, f.a); |
1123 |
| - |
1124 |
| - [[backgroundColor colorUsingColorSpace:[NSColorSpace deviceRGBColorSpace]] |
1125 |
| - getRed:&b.r |
1126 |
| - green:&b.g |
1127 |
| - blue:&b.b |
1128 |
| - alpha:&b.a]; |
1129 |
| - //NSLog(@"bg: %f %f %f %f", b.r, b.g, b.b, b.a); |
1130 |
| - |
1131 |
| -#define blend_value(f, b) (((f)*2.0 + (b)) / 3.0) |
1132 |
| - return [NSColor colorWithDeviceRed:blend_value(f.r, b.r) |
1133 |
| - green:blend_value(f.g, b.g) |
1134 |
| - blue:blend_value(f.b, b.b) |
1135 |
| - alpha:f.a]; |
1136 |
| -#undef blend_value |
| 1113 | + return [[foregroundColor blendedColorWithFraction:kBlendedBackgroundColorFraction ofColor:backgroundColor] |
| 1114 | + colorWithAlphaComponent:foregroundColor.alphaComponent]; |
1137 | 1115 | }
|
1138 | 1116 |
|
1139 | 1117 | static NSFontDescriptor *getFontDescriptor(NSString *fullname) {
|
|
0 commit comments