Add alternative appIcon for dark-mode (#204)

This commit is contained in:
Knut Ahlers 2024-12-05 14:59:20 +01:00 committed by GitHub
parent 6f59345316
commit 9942abc02b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -23,6 +23,7 @@ type (
// Customize holds the structure of the customization file // Customize holds the structure of the customization file
Customize struct { Customize struct {
AppIcon string `json:"appIcon,omitempty" yaml:"appIcon"` AppIcon string `json:"appIcon,omitempty" yaml:"appIcon"`
AppIconDark string `json:"appIconDark,omitempty" yaml:"appIconDark"`
AppTitle string `json:"appTitle,omitempty" yaml:"appTitle"` AppTitle string `json:"appTitle,omitempty" yaml:"appTitle"`
DisableAppTitle bool `json:"disableAppTitle,omitempty" yaml:"disableAppTitle"` DisableAppTitle bool `json:"disableAppTitle,omitempty" yaml:"disableAppTitle"`
DisablePoweredBy bool `json:"disablePoweredBy,omitempty" yaml:"disablePoweredBy"` DisablePoweredBy bool `json:"disablePoweredBy,omitempty" yaml:"disablePoweredBy"`

View File

@ -7,13 +7,13 @@
@click.prevent="$root.navigate('/')" @click.prevent="$root.navigate('/')"
> >
<i <i
v-if="!$root.customize.appIcon" v-if="!appIcon"
class="fas fa-user-secret mr-1" class="fas fa-user-secret mr-1"
/> />
<img <img
v-else v-else
class="mr-1" class="mr-1"
:src="$root.customize.appIcon" :src="appIcon"
> >
<span v-if="!$root.customize.disableAppTitle">{{ $root.customize.appTitle }}</span> <span v-if="!$root.customize.disableAppTitle">{{ $root.customize.appTitle }}</span>
</a> </a>
@ -77,6 +77,17 @@
<script> <script>
export default { export default {
computed: {
appIcon() {
// Use specified icon or fall back to null
const appIcon = this.$root.customize.appIcon || null
// Use specified icon or fall back to light-mode appIcon (which might be null)
const darkIcon = this.$root.customize.appIconDark || appIcon
return this.$root.darkTheme ? darkIcon : appIcon
},
},
name: 'AppNavbar', name: 'AppNavbar',
} }
</script> </script>