mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: begin nuking alpha beta gamma
This commit is contained in:
@@ -7,63 +7,84 @@ const themeStore = useThemeStore();
|
|||||||
const { darkMode, theme } = toRefs(themeStore);
|
const { darkMode, theme } = toRefs(themeStore);
|
||||||
|
|
||||||
const setDarkMode = ref<boolean>(false);
|
const setDarkMode = ref<boolean>(false);
|
||||||
|
const setGradient = ref<boolean>(false);
|
||||||
|
const setDescription = ref<boolean>(true);
|
||||||
|
const setBanner = ref<boolean>(true);
|
||||||
|
|
||||||
const toggleSwitch= (value: boolean) => {
|
const toggleSwitch = (value: boolean) => {
|
||||||
setDarkMode.value = value;
|
setDarkMode.value = value;
|
||||||
}
|
};
|
||||||
const textPrimary = ref<string>("");
|
const toggleGradient = (value: boolean) => {
|
||||||
const textSecondary = ref<string>("");
|
setGradient.value = value;
|
||||||
const bgColor = ref<string>("");
|
};
|
||||||
|
const toggleDescription = (value: boolean) => {
|
||||||
|
setDescription.value = value;
|
||||||
|
};
|
||||||
|
const toggleBanner = (value: boolean) => {
|
||||||
|
setBanner.value = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const textPrimary = ref<string>('');
|
||||||
|
const textSecondary = ref<string>('');
|
||||||
|
const bgColor = ref<string>('');
|
||||||
|
|
||||||
const textPrimaryToSet = computed(() => {
|
const textPrimaryToSet = computed(() => {
|
||||||
if (textPrimary.value) {
|
if (textPrimary.value) {
|
||||||
return textPrimary.value;
|
return textPrimary.value;
|
||||||
}
|
}
|
||||||
return darkMode.value ? defaultColors.dark.headerTextPrimary : defaultColors.light.headerTextPrimary;
|
return darkMode.value ? defaultColors.dark.headerTextPrimary : defaultColors.light.headerTextPrimary;
|
||||||
})
|
});
|
||||||
|
|
||||||
const textSecondaryToSet = computed(() => {
|
const textSecondaryToSet = computed(() => {
|
||||||
if (textSecondary.value) {
|
if (textSecondary.value) {
|
||||||
return textSecondary.value;
|
return textSecondary.value;
|
||||||
}
|
}
|
||||||
return darkMode.value ? defaultColors.dark.headerTextSecondary : defaultColors.light.headerTextSecondary;
|
return darkMode.value
|
||||||
})
|
? defaultColors.dark.headerTextSecondary
|
||||||
|
: defaultColors.light.headerTextSecondary;
|
||||||
|
});
|
||||||
|
|
||||||
const bgColorToSet = computed(() => {
|
const bgColorToSet = computed(() => {
|
||||||
if (bgColor.value) {
|
if (bgColor.value) {
|
||||||
return bgColor.value;
|
return bgColor.value;
|
||||||
}
|
}
|
||||||
return darkMode.value ? defaultColors.dark.headerBackgroundColor : defaultColors.light.headerBackgroundColor;
|
return darkMode.value
|
||||||
})
|
? defaultColors.dark.headerBackgroundColor
|
||||||
|
: defaultColors.light.headerBackgroundColor;
|
||||||
|
});
|
||||||
|
|
||||||
watch([setDarkMode, bgColorToSet, textSecondaryToSet, textPrimaryToSet], (newVal) => {
|
watch([setDarkMode, bgColorToSet, textSecondaryToSet, textPrimaryToSet], (newVal) => {
|
||||||
console.log(newVal);
|
console.log(newVal);
|
||||||
const themeToSet: Theme = {
|
const themeToSet: Theme = {
|
||||||
banner: true,
|
banner: setBanner.value,
|
||||||
bannerGradient: true,
|
bannerGradient: setGradient.value,
|
||||||
descriptionShow: true,
|
descriptionShow: setDescription.value,
|
||||||
textColor: textPrimaryToSet.value,
|
textColor: textPrimaryToSet.value,
|
||||||
metaColor: textSecondaryToSet.value,
|
metaColor: textSecondaryToSet.value,
|
||||||
bgColor: bgColorToSet.value,
|
bgColor: bgColorToSet.value,
|
||||||
name: setDarkMode.value ? 'black' : 'light',
|
name: setDarkMode.value ? 'black' : 'light',
|
||||||
}
|
};
|
||||||
themeStore.setTheme(themeToSet);
|
themeStore.setTheme(themeToSet);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 border-solid border-2 p-2 border-r-2">
|
<div class="flex flex-col gap-2 border-solid border-2 p-2 border-r-2">
|
||||||
<h1 class="text-lg">Color Theme Customization</h1>
|
<h1 class="text-lg">Color Theme Customization</h1>
|
||||||
<Label for="primary-text-color">Header Primary Text Color</label>
|
<Label for="primary-text-color">Header Primary Text Color</Label>
|
||||||
<Input id="primary-text-color" v-model="textPrimary" />
|
<Input id="primary-text-color" v-model="textPrimary" />
|
||||||
<Label for="primary-text-color">Header Secondary Text Color</label>
|
<Label for="primary-text-color">Header Secondary Text Color</Label>
|
||||||
<Input id="primary-text-color" v-model="textSecondary" />
|
<Input id="primary-text-color" v-model="textSecondary" />
|
||||||
<Label for="primary-text-color">Header Background Color</label>
|
<Label for="primary-text-color">Header Background Color</Label>
|
||||||
<Input id="primary-text-color" v-model="bgColor" />
|
<Input id="primary-text-color" v-model="bgColor" />
|
||||||
<Label for="dark-mode">Dark Mode</Label>
|
<Label for="dark-mode">Dark Mode</Label>
|
||||||
<Switch id="dark-mode" @update:checked="toggleSwitch"/>
|
<Switch id="dark-mode" @update:checked="toggleSwitch" />
|
||||||
|
<Label for="gradient">Gradient</Label>
|
||||||
|
<Switch id="gradient" @update:checked="toggleGradient" />
|
||||||
|
<Label for="description">Description</Label>
|
||||||
|
<Switch id="description" @update:checked="toggleDescription" />
|
||||||
|
<Label for="banner">Banner</Label>
|
||||||
|
<Switch id="banner" @update:checked="toggleBanner" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export { default as SheetDescription } from './SheetDescription.vue'
|
|||||||
export { default as SheetFooter } from './SheetFooter.vue'
|
export { default as SheetFooter } from './SheetFooter.vue'
|
||||||
|
|
||||||
export const sheetVariants = cva(
|
export const sheetVariants = cva(
|
||||||
'fixed z-50 gap-4 bg-alpha shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
'fixed z-50 bg-muted dark:bg-background gap-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
side: {
|
side: {
|
||||||
|
|||||||
@@ -21,24 +21,15 @@ interface ColorMode {
|
|||||||
headerTextPrimary: string;
|
headerTextPrimary: string;
|
||||||
headerTextSecondary: string;
|
headerTextSecondary: string;
|
||||||
headerBackgroundColor: string;
|
headerBackgroundColor: string;
|
||||||
alpha: string;
|
|
||||||
beta: string;
|
|
||||||
gamma: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultColors: Record<string, ColorMode> = {
|
export const defaultColors: Record<string, ColorMode> = {
|
||||||
dark: {
|
dark: {
|
||||||
alpha: '#1c1c1c', // previously header custom text color
|
|
||||||
beta: '#f2f2f2', // previously header background color
|
|
||||||
gamma: '#999999', // previously header custom secondary text color
|
|
||||||
headerTextPrimary: '#1c1c1c',
|
headerTextPrimary: '#1c1c1c',
|
||||||
headerBackgroundColor: '#f2f2f2',
|
headerBackgroundColor: '#f2f2f2',
|
||||||
headerTextSecondary: '#999999',
|
headerTextSecondary: '#999999',
|
||||||
},
|
},
|
||||||
light: {
|
light: {
|
||||||
alpha: '#f2f2f2', // previously header custom text color
|
|
||||||
beta: '#1c1b1b', // previously header background color
|
|
||||||
gamma: '#999999', // previously header custom secondary text color
|
|
||||||
headerTextPrimary: '#f2f2f2',
|
headerTextPrimary: '#f2f2f2',
|
||||||
headerBackgroundColor: '#1c1b1b',
|
headerBackgroundColor: '#1c1b1b',
|
||||||
headerTextSecondary: '#999999',
|
headerTextSecondary: '#999999',
|
||||||
@@ -68,32 +59,34 @@ export const useThemeStore = defineStore('theme', () => {
|
|||||||
const setCssVars = () => {
|
const setCssVars = () => {
|
||||||
const body = document.body;
|
const body = document.body;
|
||||||
|
|
||||||
let { alpha, beta, gamma, headerTextPrimary, headerTextSecondary, headerBackgroundColor } =
|
let { headerTextPrimary, headerTextSecondary, headerBackgroundColor } = darkMode.value
|
||||||
darkMode.value ? defaultColors.dark : defaultColors.light;
|
? defaultColors.dark
|
||||||
|
: defaultColors.light;
|
||||||
// overwrite with hex colors set in webGUI @ /Settings/DisplaySettings
|
// overwrite with hex colors set in webGUI @ /Settings/DisplaySettings
|
||||||
if (theme.value?.textColor) {
|
if (theme.value?.textColor) {
|
||||||
headerTextPrimary = theme.value?.textColor;
|
headerTextPrimary = theme.value?.textColor;
|
||||||
}
|
}
|
||||||
if (theme.value?.bgColor) {
|
if (theme.value?.bgColor) {
|
||||||
headerBackgroundColor = theme.value.bgColor;
|
headerBackgroundColor = theme.value.bgColor;
|
||||||
body.style.setProperty('--color-customgradient-start', hexToRgba(beta, 0));
|
body.style.setProperty('--color-customgradient-start', hexToRgba(headerBackgroundColor, 0));
|
||||||
body.style.setProperty('--color-customgradient-end', hexToRgba(beta, 0.7));
|
body.style.setProperty('--color-customgradient-end', hexToRgba(headerBackgroundColor, 0.7));
|
||||||
}
|
}
|
||||||
if (theme.value?.metaColor) {
|
if (theme.value?.metaColor) {
|
||||||
headerTextSecondary = theme.value?.metaColor;
|
headerTextSecondary = theme.value?.metaColor;
|
||||||
}
|
}
|
||||||
body.style.setProperty('--color-alpha', alpha);
|
|
||||||
body.style.setProperty('--color-beta', beta);
|
|
||||||
body.style.setProperty('--color-gamma', gamma);
|
|
||||||
body.style.setProperty('--header-text-primary', headerTextPrimary);
|
body.style.setProperty('--header-text-primary', headerTextPrimary);
|
||||||
body.style.setProperty('--header-text-secondary', headerTextSecondary);
|
body.style.setProperty('--header-text-secondary', headerTextSecondary);
|
||||||
body.style.setProperty('--header-background-color', headerBackgroundColor);
|
body.style.setProperty('--header-background-color', headerBackgroundColor);
|
||||||
body.style.setProperty('--color-gamma-opaque', hexToRgba(gamma, 0.25));
|
body.style.setProperty('--color-gamma-opaque', hexToRgba(headerTextSecondary, 0.25));
|
||||||
// box shadow
|
// box shadow
|
||||||
body.style.setProperty('--shadow-beta', `0 25px 50px -12px ${hexToRgba(beta, 0.15)}`);
|
body.style.setProperty(
|
||||||
body.style.setProperty('--ring-offset-shadow', `0 0 ${beta}`);
|
'--shadow-beta',
|
||||||
body.style.setProperty('--ring-shadow', `0 0 ${beta}`);
|
`0 25px 50px -12px ${hexToRgba(headerBackgroundColor, 0.15)}`
|
||||||
body.style.setProperty('--dev-test', `0 0 ${beta}`);
|
);
|
||||||
|
body.style.setProperty('--ring-offset-shadow', `0 0 ${headerBackgroundColor}`);
|
||||||
|
body.style.setProperty('--ring-shadow', `0 0 ${headerBackgroundColor}`);
|
||||||
|
body.style.setProperty('--dev-test', `0 0 ${headerBackgroundColor}`);
|
||||||
|
|
||||||
if (darkMode.value) {
|
if (darkMode.value) {
|
||||||
document.body.classList.add('dark');
|
document.body.classList.add('dark');
|
||||||
|
|||||||
Reference in New Issue
Block a user