From 70b5105daabbe29c190a10ba899feec4e4dc66f5 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sun, 21 Apr 2013 14:22:34 +0100 Subject: [PATCH] Fixed: CPColor colorWithHue:saturation:brightness: returning undefined. A hue of 1.0 would cause the CPColor colorWithHue:saturation:brightness: method to return `undefined` instead of a CPColor instance. --- AppKit/CPColor.j | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/AppKit/CPColor.j b/AppKit/CPColor.j index 88e2072d4..e3fdd083e 100644 --- a/AppKit/CPColor.j +++ b/AppKit/CPColor.j @@ -215,12 +215,19 @@ var cachedBlackColor, switch (FLOOR(hue * 6)) { - case 0: return [CPColor colorWithCalibratedRed:b green:t blue:p alpha:alpha]; - case 1: return [CPColor colorWithCalibratedRed:q green:b blue:p alpha:alpha]; - case 2: return [CPColor colorWithCalibratedRed:p green:b blue:t alpha:alpha]; - case 3: return [CPColor colorWithCalibratedRed:p green:q blue:b alpha:alpha]; - case 4: return [CPColor colorWithCalibratedRed:t green:p blue:b alpha:alpha]; - case 5: return [CPColor colorWithCalibratedRed:b green:p blue:q alpha:alpha]; + case 0: + case 6: + return [CPColor colorWithCalibratedRed:b green:t blue:p alpha:alpha]; + case 1: + return [CPColor colorWithCalibratedRed:q green:b blue:p alpha:alpha]; + case 2: + return [CPColor colorWithCalibratedRed:p green:b blue:t alpha:alpha]; + case 3: + return [CPColor colorWithCalibratedRed:p green:q blue:b alpha:alpha]; + case 4: + return [CPColor colorWithCalibratedRed:t green:p blue:b alpha:alpha]; + case 5: + return [CPColor colorWithCalibratedRed:b green:p blue:q alpha:alpha]; } }