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

added profile quick info

This commit is contained in:
Fedor Katurov 2022-07-19 16:47:03 +07:00
parent 1241d2c784
commit 141b9c0d60
8 changed files with 84 additions and 32 deletions

View file

@ -1,4 +1,4 @@
import { adjustHue, darken, desaturate, parseToHsla } from 'color2k';
import { adjustHue, darken, desaturate, parseToHsla, transparentize } from 'color2k';
import { DEFAULT_DOMINANT_COLOR } from '~/constants/node';
import { stringToColour } from '~/utils/dom';
@ -30,8 +30,16 @@ export const generateGradientFromColor = (
val: string,
saturation = 3,
lightness = 3,
angle = 155
angle = 155,
opacity = 1
) => {
const [color, second, third] = generateColorTriplet(val, saturation, lightness);
return `linear-gradient(${angle}deg, ${color}, ${second}, ${third})`;
const [first, second, third] = generateColorTriplet(val, saturation, lightness).map(it => {
if (opacity > 1 || opacity < 0) {
return it;
}
return transparentize(it, 1 - opacity);
});
return `linear-gradient(${angle}deg, ${first}, ${second}, ${third})`;
};