This commit is contained in:
Timothy Jaeryang Baek
2025-03-04 01:16:08 -08:00
parent d78fe4decc
commit e3769c1073
3 changed files with 58 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
<script>
import { getContext } from 'svelte';
import { getContext, onMount } from 'svelte';
const i18n = getContext('i18n');
import { WEBUI_BASE_URL } from '$lib/constants';
@@ -10,6 +10,32 @@
export let show = true;
export let getStartedHandler = () => {};
function setLogoImage() {
const logo = document.getElementById('logo');
if (logo) {
const isDarkMode = document.documentElement.classList.contains('dark');
if (isDarkMode) {
const darkImage = new Image();
darkImage.src = '/static/favicon-dark.png';
darkImage.onload = () => {
logo.src = '/static/favicon-dark.png';
logo.style.filter = ''; // Ensure no inversion is applied if splash-dark.png exists
};
darkImage.onerror = () => {
logo.style.filter = 'invert(1)'; // Invert image if splash-dark.png is missing
};
}
}
}
$: if (show) {
setLogoImage();
}
</script>
{#if show}
@@ -18,6 +44,7 @@
<div class="flex space-x-2">
<div class=" self-center">
<img
id="logo"
crossorigin="anonymous"
src="{WEBUI_BASE_URL}/static/favicon.png"
class=" w-6 rounded-full"