Merge pull request #894 from KrishavRajSingh/krishav/fix_icon_darkmode

Fix icon theme if theme is system
This commit is contained in:
Marko Kraemer 2025-07-05 18:08:08 +02:00 committed by GitHub
commit e04d53242d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ interface KortixLogoProps {
size?: number;
}
export function KortixLogo({ size = 24 }: KortixLogoProps) {
const { theme } = useTheme();
const { theme, systemTheme } = useTheme();
const [mounted, setMounted] = useState(false);
// After mount, we can access the theme
@ -16,13 +16,17 @@ export function KortixLogo({ size = 24 }: KortixLogoProps) {
setMounted(true);
}, []);
const shouldInvert = mounted && (
theme === 'dark' || (theme === 'system' && systemTheme === 'dark')
);
return (
<Image
src="/kortix-symbol.svg"
alt="Kortix"
width={size}
height={size}
className={`${mounted && theme === 'dark' ? 'invert' : ''} flex-shrink-0`}
className={`${shouldInvert ? 'invert' : ''} flex-shrink-0`}
/>
);
}