1 import type { Instance as Color } from 'tinycolor2';
2 import tinycolor from 'tinycolor2';
4 import genAccentShades from './gen-accent-shades';
6 const getOriginal = (c: Color) => c.getOriginalInput();
8 describe('genAccentShades', () => {
9 it('generates the necessary shades for an accent color', () => {
10 const output = genAccentShades(tinycolor({ h: 240, s: 1, l: 0.75 }));
12 expect(output.map(getOriginal)).toEqual([
13 { h: 240, s: 1, l: 0.75 },
14 { h: 240, s: 0.95, l: 0.7 },
15 { h: 240, s: 0.9, l: 0.65 },
19 it("doesn't allow values to drop below 0", () => {
20 const output = genAccentShades(tinycolor({ h: 100, s: 0.01, l: 0.01 }));
22 expect(output.map(getOriginal)).toEqual([
23 { h: 100, s: 0.01, l: 0.01 },
24 { h: 100, s: 0, l: 0 },
25 { h: 100, s: 0, l: 0 },