mizar/src/renderer/libs/getContrast.ts

5 lines
170 B
TypeScript
Raw Normal View History

2023-03-19 18:40:03 +01:00
export const getContrast = (hexcolor: string) => {
if (!hexcolor) return '';
return (parseInt(hexcolor.replace('#', ''), 16) > 0xffffff / 2) ? 'dark' : 'light';
};