This commit is contained in:
Gokalp Sen 2024-12-08 17:31:28 +03:00
parent ab2ef8a002
commit 53116c5898
4 changed files with 42 additions and 10 deletions

View file

@ -59,6 +59,16 @@ body.light-theme {
color: var(--primary-color);
}
.logo {
display: flex;
align-items: center;
}
.logo img {
height: 40px;
width: auto;
}
.nav-links {
display: flex;
gap: 2rem;

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="28" height="28" version="1.1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<!-- Gray rounded square background -->
<rect x="2" y="2" width="28" height="28" rx="6" ry="6" fill="#2d2d2d"/>
<!-- Purple GsD text -->
<text x="16" y="21" fill="#bb86fc" font-family="'Segoe UI', sans-serif" font-size="14px" font-weight="bold" text-anchor="middle">GsD</text>
</svg>

Before

Width:  |  Height:  |  Size: 442 B

View file

@ -4,14 +4,21 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GsDistance</title>
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link id="favicon" rel="icon" type="image/svg+xml"
data-dark-href="https://storage.gsdistance.org/store/logo/svg1/gsdLogoDark.svg"
data-light-href="https://storage.gsdistance.org/store/logo/svg1/gsdLogoLight.svg"
href="https://storage.gsdistance.org/store/logo/svg1/gsdistanceLogoDark.svg">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://storage.gsdistance.org/store/icons/css/all.min.css">
</head>
<body>
<header>
<nav class="navbar">
<img src="favicon.svg" alt="GsDistance" width="50" height="50">
<div class="logo"
data-dark-logo="https://storage.gsdistance.org/store/logo/svg1/gsdistanceLogoDark.svg"
data-light-logo="https://storage.gsdistance.org/store/logo/svg1/gsdistanceLogoLight.svg">
<img src="https://storage.gsdistance.org/store/logo/svg1/gsdistanceLogoDark.svg" alt="GsDistance Logo">
</div>
<div class="nav-links">
<a href="#about">About</a>
<a href="#services">Services</a>

View file

@ -8,6 +8,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (savedTheme) {
body.classList.toggle('light-theme', savedTheme === 'light');
updateThemeIcon();
updateLogos(savedTheme);
}
themeToggle.addEventListener('click', () => {
@ -21,8 +22,30 @@ document.addEventListener('DOMContentLoaded', () => {
const icon = themeToggle.querySelector('i');
if (body.classList.contains('light-theme')) {
icon.className = 'fas fa-moon';
updateLogos('light');
} else {
icon.className = 'fas fa-sun';
updateLogos('dark');
}
}
function updateLogos(theme) {
const logos = document.querySelectorAll('.logo');
logos.forEach(logo => {
const logoImg = logo.querySelector('img');
if (theme === 'light') {
logoImg.src = logo.dataset.lightLogo;
} else {
logoImg.src = logo.dataset.darkLogo;
}
});
// Update favicon
const favicon = document.getElementById('favicon');
if (theme === 'light') {
favicon.href = favicon.dataset.lightHref;
} else {
favicon.href = favicon.dataset.darkHref;
}
}