customizable opacity

This commit is contained in:
Miodec 2023-03-09 15:29:28 +01:00
parent 438a1e5ac7
commit b46fa16785
2 changed files with 8 additions and 4 deletions

View file

@ -1044,9 +1044,9 @@ export async function applyBurstHeatmap(): Promise<void> {
const colors = [
themeColors.colorfulError,
Misc.blendTwoHexColors(themeColors.colorfulError, themeColors.text),
Misc.blendTwoHexColors(themeColors.colorfulError, themeColors.text, 0.5),
themeColors.text,
Misc.blendTwoHexColors(themeColors.main, themeColors.text),
Misc.blendTwoHexColors(themeColors.main, themeColors.text, 0.5),
themeColors.main,
];

View file

@ -236,7 +236,11 @@ export async function getContributorsList(): Promise<string[]> {
}
}
export function blendTwoHexColors(color1: string, color2: string): string {
export function blendTwoHexColors(
color1: string,
color2: string,
opacity: number
): string {
const rgb1 = hexToRgb(color1);
const rgb2 = hexToRgb(color2);
@ -251,7 +255,7 @@ export function blendTwoHexColors(color1: string, color2: string): string {
r: rgb2.r,
g: rgb2.g,
b: rgb2.b,
a: 0.5,
a: opacity,
};
const blended = normalBlend(rgba1, rgba2);
return rgbToHex(blended.r, blended.g, blended.b);