Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/components/UserProfile.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ onMounted(() => {
<span class="text-right text-12px sm:text-18px hidden 2xs:block" v-html="description" />
<span class="text-header-text-secondary hidden md:inline-block px-8px">&bull;</span>
</template>
<button :title="t('Click to Copy LAN IP {0}', [lanIp])" class="opacity-100 hover:opacity-75 focus:opacity-75 transition-opacity" @click="copyLanIp()">
<button :title="t('Click to Copy LAN IP {0}', [lanIp])" class="text-header-text-primary opacity-100 hover:opacity-75 focus:opacity-75 transition-opacity" @click="copyLanIp()">
{{ name }}
</button>
<span
Expand All @@ -132,7 +132,7 @@ onMounted(() => {
</span>
</h1>

<div class="block w-2px h-24px bg-popover" />
<div class="block w-2px h-24px bg-header-text-secondary" />

<!-- Keep the sidebar out of staging/prod builds, but easily accessible for development -->
<NotificationsSidebar />
Expand Down
2 changes: 1 addition & 1 deletion web/components/UserProfile/ServerState.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const upgradeAction = computed((): ServerStateDataAction | undefined => {
<span class="flex flex-row items-center gap-x-8px">
<template v-if="upgradeAction">
<UpcServerStateBuy
class="text-white"
class="text-header-text-secondary"
:title="t('Upgrade Key')"
@click="upgradeAction.click?.()"
>
Expand Down
49 changes: 47 additions & 2 deletions web/store/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,52 @@ export const defaultColors: Record<string, ThemeVariables> = {
},
} as const;

/**
* Unraid default theme colors do not have consistent colors for the header.
* This is a workaround to set the correct colors for the header.
* DARK THEMES: black, gray
* DARK HEADER THEMES: white, gray
* LIGHT THEMES: white, gray
* LIGHT HEADER THEMES: black, gray
*/
export const defaultAzureGrayHeaderColors: ThemeVariables = { // azure and gray header colors are the same but the background color is different
'--header-text-primary': '#39587f',
'--header-text-secondary': '#606e7f',
};
export const defaultHeaderColors: Record<string, ThemeVariables> = {
azure: {
...defaultAzureGrayHeaderColors,
'--header-background-color': '#1c1b1b',
},
black: {
'--header-text-primary': '#1c1c1c',
'--header-text-secondary': '#999999',
'--header-background-color': '#f2f2f2',
},
gray: {
...defaultAzureGrayHeaderColors,
'--header-background-color': '#f2f2f2',
},
white: {
'--header-text-primary': '#f2f2f2',
'--header-text-secondary': '#999999',
'--header-background-color': '#1c1b1b',
},
};

// used to swap the UPC text color when using the azure or gray theme
export const DARK_THEMES = ['black', 'gray'] as const;

export const useThemeStore = defineStore('theme', () => {
// State
const theme = ref<Theme | undefined>();

const activeColorVariables = ref<ThemeVariables>(defaultColors.light);
// Getters
const activeColorVariables = ref<ThemeVariables>({
...defaultColors.light,
...defaultHeaderColors['white'],
});

// Getters
const darkMode = computed<boolean>(
() => DARK_THEMES.includes(theme.value?.name as (typeof DARK_THEMES)[number]) ?? false
);
Expand All @@ -106,6 +142,15 @@ export const useThemeStore = defineStore('theme', () => {
const body = document.body;
const selectedMode = darkMode.value ? 'dark' : 'light';

// set the default header colors for the current theme
const themeName = theme.value?.name;
if (themeName && themeName in defaultHeaderColors) {
customColorVariables[selectedMode] = {
...customColorVariables[selectedMode],
...defaultHeaderColors[themeName],
};
}

// overwrite with hex colors set in webGUI @ /Settings/DisplaySettings
if (theme.value?.textColor) {
customColorVariables[selectedMode]['--header-text-primary'] = theme.value.textColor;
Expand Down
Loading