@sil/color
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -62,2 +62,41 @@ "use strict"; | ||
}); | ||
const setLightnessTest = [ | ||
{ | ||
input: { r: 0, g: 0, b: 0 }, | ||
amount: 25, | ||
output: { r: 64, g: 64, b: 64 }, | ||
}, | ||
{ | ||
input: { r: 127, g: 127, b: 127 }, | ||
amount: 50, | ||
output: { r: 128, g: 128, b: 128 }, | ||
}, | ||
{ | ||
input: { h: 0, s: 0, l: 0 }, | ||
amount: 75, | ||
output: { h: 0, s: 0, l: 75 }, | ||
}, | ||
{ | ||
input: { h: 0, s: 0, l: 10 }, | ||
amount: 100, | ||
output: { h: 0, s: 0, l: 100 }, | ||
}, | ||
{ | ||
input: "#000000", | ||
amount: 50, | ||
output: "#808080", | ||
}, | ||
{ | ||
input: "#FF0000", | ||
amount: 25, | ||
output: "#800000", | ||
}, | ||
]; | ||
describe("Set Lightened color", () => { | ||
setLightnessTest.forEach((value) => { | ||
it(`should convert any color to a lighter version`, () => { | ||
expect((0, manipulate_1.setLightness)(value.input, value.amount)).toEqual(value.output); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=manipulate.test.js.map |
{ | ||
"name": "@sil/color", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -8,3 +8,4 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"test": "jest" | ||
"test": "jest", | ||
"prepublishOnly": "npm run test" | ||
}, | ||
@@ -11,0 +12,0 @@ "author": "Sil van Diepen", |
import { lighten, darken, setLightness } from "./manipulate"; | ||
import { HSL, RGB } from "./types"; | ||
import { HEX, HSL, RGB } from "./types"; | ||
@@ -64,1 +64,45 @@ const lightenColors = [ | ||
}); | ||
const setLightnessTest: { | ||
input: RGB | HSL | HEX; | ||
amount: HSL["l"]; | ||
output: RGB | HSL | HEX; | ||
}[] = [ | ||
{ | ||
input: { r: 0, g: 0, b: 0 } as RGB, | ||
amount: 25, | ||
output: { r: 64, g: 64, b: 64 } as RGB, | ||
}, | ||
{ | ||
input: { r: 127, g: 127, b: 127 } as RGB, | ||
amount: 50, | ||
output: { r: 128, g: 128, b: 128 } as RGB, | ||
}, | ||
{ | ||
input: { h: 0, s: 0, l: 0 } as HSL, | ||
amount: 75, | ||
output: { h: 0, s: 0, l: 75 } as HSL, | ||
}, | ||
{ | ||
input: { h: 0, s: 0, l: 10 } as HSL, | ||
amount: 100, | ||
output: { h: 0, s: 0, l: 100 } as HSL, | ||
}, | ||
{ | ||
input: "#000000" as HEX, | ||
amount: 50, | ||
output: "#808080" as HEX, | ||
}, | ||
{ | ||
input: "#FF0000" as HEX, | ||
amount: 25, | ||
output: "#800000" as HEX, | ||
}, | ||
]; | ||
describe("Set Lightened color", () => { | ||
setLightnessTest.forEach((value) => { | ||
it(`should convert any color to a lighter version`, () => { | ||
expect(setLightness(value.input, value.amount)).toEqual(value.output); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
108062
2148