color-forge
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -248,3 +248,3 @@ 'use strict'; | ||
var brightness = newColor.values[index] + amount * (max - min) / 2; | ||
var brightness = newColor.values[index] + amount * (max - min); | ||
// Clip brightness to bounds | ||
@@ -269,2 +269,6 @@ newColor.values[index] = Math.min(max, Math.max(min, brightness)); | ||
Color.prototype.darken = function darken(amount, mode) { | ||
if (amount === undefined) { | ||
amount = 0.1; // Otherwise will be NaN in #lighten | ||
} | ||
return this.lighten(-amount, mode); | ||
@@ -271,0 +275,0 @@ }; |
{ | ||
"name": "color-forge", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "A simple color system based on the work of https://github.com/dfcreative/color-space", | ||
@@ -5,0 +5,0 @@ "url": "https://github.com/jacobp100/color-forge", |
@@ -80,6 +80,6 @@ /* eslint-env node, mocha */ | ||
}); | ||
// Conformance with http://sassmeister.com (where 25 on there is 0.5 here) | ||
// Conformance with http://sassmeister.com (where 25 on there is 0.25 here) | ||
it('Should darken colours via rgb', function() { | ||
assert.about(Color.hex('#fff').darken(0.5), Color.hex('#bfbfbf')); | ||
assert.about(Color.hex('#f80').darken(0.5), Color.hex('#804400')); | ||
assert.about(Color.hex('#fff').darken(0.5), Color.hex('#808080')); | ||
assert.about(Color.hex('#f80').darken(0.5), Color.hex('#000000')); | ||
assert.about(Color.hex('#000').darken(0.5), Color.hex('#000000')); | ||
@@ -89,4 +89,4 @@ }); | ||
assert.about(Color.hex('#fff').lighten(0.5), Color.hex('#ffffff')); | ||
assert.about(Color.hex('#f80').lighten(0.5), Color.hex('#ffc380')); | ||
assert.about(Color.hex('#000').lighten(0.5), Color.hex('#404040')); | ||
assert.about(Color.hex('#f80').lighten(0.5), Color.hex('#ffffff')); | ||
assert.about(Color.hex('#000').lighten(0.5), Color.hex('#808080')); | ||
}); | ||
@@ -93,0 +93,0 @@ it('Should add colours', function() { |
53732
939