Skip to content

Commit 4958ac5

Browse files
authored
Merge pull request #1618 from Grandi0z/cypht-fix-mobil-logo-and-them-path
fix(frontend): dynamically set logo based on theme in navigation bar
2 parents 23054c8 + 4f1cf60 commit 4958ac5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

modules/core/navigation/navbar.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ $(() => {
2121
</div>
2222
`
2323

24+
// Get the appropriate logo based on current theme
25+
const getLogoPath = () => {
26+
const isDarkTheme = getComputedStyle(document.documentElement)
27+
.getPropertyValue('--bs-secondary-bg') === '#333';
28+
const logoFile = isDarkTheme ? 'logo.svg' : 'logo_dark.svg';
29+
return `${hm_web_root_path()}modules/core/assets/images/${logoFile}`;
30+
};
31+
2432
const navHeader = `
2533
<div class="nav-header">
2634
<a href="?page=home" class="menu_home">
27-
<img class="app-logo" src="modules/core/assets/images/logo_dark.svg">
35+
<img class="app-logo" src="${getLogoPath()}">
2836
</a>
2937
<div class="menu-toggle fw-bold cursor-pointer close-toggle" style="display: none;">
3038
<i class="bi bi-x-lg fs-5 fw-bold"></i>

modules/core/site.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ div.unseen,
14541454
justify-content: flex-end;
14551455
padding: 0;
14561456
border-bottom: 1px solid var(--bs-secondary-bg);
1457+
background-color: var(--bs-body-bg);
14571458
}
14581459

14591460
.mobile .nav-header a {

0 commit comments

Comments
 (0)