fix: pass resoled colors to session icon on first render

pull/3083/head
William Grant 1 year ago
parent b102a0675f
commit 5df14e74ff

@ -22,13 +22,11 @@ const convertIconToImageURL = async (
'iconType' | 'iconSize' | 'iconColor' | 'backgroundColor' 'iconType' | 'iconSize' | 'iconColor' | 'backgroundColor'
> >
): Promise<{ dataUrl: string; bgColor: string; fgColor: string }> => { ): Promise<{ dataUrl: string; bgColor: string; fgColor: string }> => {
const { isThemed, isDarkTheme, iconType, iconSize, iconColor, backgroundColor } = props; const { isThemed, isDarkTheme, iconType, iconSize } = props;
let { iconColor, backgroundColor } = props;
let bgColor = backgroundColor; if (!backgroundColor) {
let fgColor = iconColor; backgroundColor = chooseIconColors(
if (!bgColor) {
bgColor = chooseIconColors(
isThemed, isThemed,
isDarkTheme, isDarkTheme,
'--text-primary-color', '--text-primary-color',
@ -37,8 +35,8 @@ const convertIconToImageURL = async (
); );
} }
if (!fgColor) { if (!iconColor) {
fgColor = chooseIconColors( iconColor = chooseIconColors(
isThemed, isThemed,
isDarkTheme, isDarkTheme,
'--background-primary-color', '--background-primary-color',
@ -70,8 +68,8 @@ const convertIconToImageURL = async (
root?.removeChild(divElement); root?.removeChild(divElement);
return { return {
bgColor, bgColor: backgroundColor,
fgColor, fgColor: iconColor,
dataUrl: svgString ? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgString)}` : '', dataUrl: svgString ? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgString)}` : '',
}; };
}; };

Loading…
Cancel
Save