Chat: Fixes for Badge (#1021)

This commit is contained in:
Alexander Zinchuk 2021-04-19 18:37:01 +03:00
parent 7484124533
commit 4df0f9477f
4 changed files with 13 additions and 5 deletions

View File

@ -43,7 +43,9 @@
background: var(--color-green);
}
&.pinned {
&.pinned:not(.unread) {
color: var(--color-pinned);
background: transparent;
width: 1.5rem;
padding: 0;

View File

@ -100,6 +100,8 @@ $color-user-8: #faa774;
--color-placeholders: #{$color-placeholders};
--color-pinned: #{$color-white};
--color-code: #4a729a;
--color-code-bg: #{rgba($color-text-secondary, .08)};
--color-code-own: #3c7940;

View File

@ -10,6 +10,7 @@
"--color-borders-input": ["#DADCE0", "#5B5B5A"],
"--color-links": ["#52A1EF", "#868DF6"],
"--color-gray": ["#C4C9CC", "#808080"],
"--color-pinned": ["#C4C9CC", "#707579"],
"--color-default-shadow": ["#72727240", "#21212140"],
"--color-light-shadow": ["#7272722B", "#00000040"],
"--color-green": ["#4DCD5E", "#868DF5"],

View File

@ -73,7 +73,7 @@ function hexToRgb(hex: string): RGBAColor {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
a: result[4] ? parseInt(result[4], 16) : undefined,
a: result[4] !== undefined ? parseInt(result[4], 16) : undefined,
};
}
@ -82,9 +82,12 @@ function applyColorAnimationStep(startIndex: number, endIndex: number, interpola
const r = Math.round(lerp(propertyColors[startIndex].r, propertyColors[endIndex].r, interpolationRatio));
const g = Math.round(lerp(propertyColors[startIndex].g, propertyColors[endIndex].g, interpolationRatio));
const b = Math.round(lerp(propertyColors[startIndex].b, propertyColors[endIndex].b, interpolationRatio));
const a = propertyColors[startIndex].a
&& Math.round(lerp(propertyColors[startIndex].a!, propertyColors[endIndex].a!, interpolationRatio));
const a = propertyColors[startIndex].a !== undefined
? Math.round(lerp(propertyColors[startIndex].a!, propertyColors[endIndex].a!, interpolationRatio))
: undefined;
document.documentElement.style.setProperty(property, a ? `rgba(${r},${g},${b},${a / 255})` : `rgb(${r},${g},${b})`);
document.documentElement.style.setProperty(property, a !== undefined
? `rgba(${r},${g},${b},${a / 255})`
: `rgb(${r},${g},${b})`);
});
}