1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

added flow shade

This commit is contained in:
Fedor Katurov 2021-10-05 18:13:01 +07:00
parent 57d803f4d8
commit 59ca076287
7 changed files with 56 additions and 2 deletions

13
src/utils/color.ts Normal file
View file

@ -0,0 +1,13 @@
export const convertHexToRGBA = (hexCode, opacity) => {
let hex = hexCode.replace('#', '');
if (hex.length === 3) {
hex = `${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`;
}
const r = parseInt(hex.substring(0, 2), 16);
const g = parseInt(hex.substring(2, 4), 16);
const b = parseInt(hex.substring(4, 6), 16);
return `rgba(${r},${g},${b},${opacity})`;
};