Better colors

This commit is contained in:
Gregory John Casamento 2020-04-17 18:03:26 -04:00
parent dae6b91c99
commit da0f7ded36
3 changed files with 22 additions and 8 deletions

View file

@ -965,13 +965,15 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
forState: (NSControlStateValue)value;
- (void) drawSwitchBezel: (NSRect)frame
withColor: (NSColor*)backgroundColor
withOnColor: (NSColor*)onColor
withOffColor: (NSColor*)offColor
forState: (NSControlStateValue)v;
- (void) drawSwitchInRect: (NSRect)rect
forState: (NSControlStateValue)state
enabled: (BOOL)enabled
bezelColor: (NSColor *)bColor
bezelOnColor: (NSColor *)bOnColor
bezelOffColor: (NSColor *)bOffColor
knobColor: (NSColor *)kColor;
// NSSegmentedControl drawing methods

View file

@ -819,13 +819,20 @@
// NSSwitch drawing methods
- (void) drawSwitchBezel: (NSRect)frame
withColor: (NSColor*)backgroundColor
withOnColor: (NSColor*)onColor
withOffColor: (NSColor*)offColor
forState: (NSControlStateValue)v
{
NSBezierPath *p;
NSPoint point;
CGFloat radius;
NSColor *backgroundColor = offColor;
if (NSControlStateValueOn == v)
{
backgroundColor = onColor;
}
// make smaller than enclosing frame
frame = NSInsetRect(frame, 4, 4);
radius = frame.size.height / 2.0;
@ -917,13 +924,17 @@
- (void) drawSwitchInRect: (NSRect)rect
forState: (NSControlStateValue)state
enabled: (BOOL)enabled
bezelColor: (NSColor *)bColor
bezelOnColor: (NSColor *)bOnColor
bezelOffColor: (NSColor *)bOffColor
knobColor: (NSColor *)kColor
{
// Draw the well bezel
[self drawSwitchBezel: rect
withColor: bColor
forState: state];
withOnColor: bOnColor
withOffColor: bOffColor
forState: state];
// Draw the knob
[self drawSwitchKnob: rect
withColor: kColor
forState: state];

View file

@ -73,8 +73,9 @@
[[GSTheme theme] drawSwitchInRect: rect
forState: _state
enabled: [self isEnabled]
bezelColor: [NSColor blackColor]
knobColor: [NSColor redColor]];
bezelOnColor: [NSColor lightGrayColor]
bezelOffColor: [NSColor blackColor]
knobColor: [NSColor darkGrayColor]];
}
- (void) mouseDown: (NSEvent *)event