Start refactoring state management

This commit is contained in:
schmelczerandras 2019-08-31 21:21:21 +02:00
commit a9ad628488

16
src/app/utils/color.ts Normal file
View file

@ -0,0 +1,16 @@
import { IColor } from '../interfaces/persistance/color';
export const lighten = (by: number, { h, s, l }: IColor): IColor => {
let newL = l + by;
if (newL > 100) {
newL = 100;
} else if (newL < 0) {
newL = 0;
}
return { h, s, l: newL, type: 'Color' };
};
export const toHslString = ({ h, s, l }: IColor): string => {
return `hsl(${h}, ${s}%, ${l}%)`;
};