Compare commits

..

No commits in common. "7098dda6b4f1a6d530978caa8120d2552ac303be" and "441dc0c15cdb3391db283e89ec678970ca9e6b1c" have entirely different histories.

5 changed files with 14 additions and 11 deletions

View file

@ -8,7 +8,7 @@
<span class="theme-preview" <span class="theme-preview"
:title="theme.displayName" :title="theme.displayName"
:style="{background:`linear-gradient(${theme.previewGradient})`}" :style="{background:`linear-gradient(${theme.previewGradient})`}"
@click="changeTheme(theme.id, theme.themeUrl)" @click="changeTheme(theme.ID, theme.themeURL)"
> >
<span class="theme-title" :style="{color:`${theme.complementaryColor}`}"> <span class="theme-title" :style="{color:`${theme.complementaryColor}`}">
{{ theme.displayName }} {{ theme.displayName }}
@ -34,19 +34,19 @@ let themeLinkElement: HTMLLinkElement | null = null;
const themes: Array<Theme> = [] const themes: Array<Theme> = []
interface Theme { interface Theme {
id: string ID: string
displayName: string displayName: string
previewGradient: string previewGradient: string
complementaryColor: string complementaryColor: string
themeUrl: string themeURL: string
} }
function changeTheme(id: string, url: string) { function changeTheme(ID: string, URL: string) {
if (themeLinkElement && themeLinkElement.getAttribute('href') === `${baseURL}themes/${url}`) { if (themeLinkElement && themeLinkElement.getAttribute('href') === `${baseURL}themes/${URL}`) {
return; return;
} }
localStorage.setItem("selectedTheme", id); localStorage.setItem("selectedTheme", ID);
// if the theme didn't originally load for some reason, create it // if the theme didn't originally load for some reason, create it
if (!themeLinkElement) { if (!themeLinkElement) {
@ -55,14 +55,14 @@ function changeTheme(id: string, url: string) {
document.head.appendChild(themeLinkElement); document.head.appendChild(themeLinkElement);
} }
themeLinkElement.href = `${baseURL}themes/${url}`; themeLinkElement.href = `${baseURL}themes/${URL}`;
} }
const fetchThemes = async () => { const fetchThemes = async () => {
for (const theme of defaultThemes) { for (const theme of defaultThemes) {
const themeConfig = await fetch(`${baseURL}themes/${theme}.json`) const themeConfig = await fetch(`${baseURL}themes/${theme}.json`)
const themeConfigJson = await themeConfig.json() as Theme const themeConfigJson = await themeConfig.json() as Theme
themeConfigJson.id = theme themeConfigJson.ID = theme
themes.push(themeConfigJson) themes.push(themeConfigJson)
} }

View file

@ -40,6 +40,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from 'vue';
import Button from '~/components/Button.vue';
const { logout } = useAuth() const { logout } = useAuth()
const appConfig = useRuntimeConfig() const appConfig = useRuntimeConfig()

View file

@ -2,5 +2,5 @@
"displayName": "Ash", "displayName": "Ash",
"previewGradient": "45deg, #2f2e2d, #46423b", "previewGradient": "45deg, #2f2e2d, #46423b",
"complementaryColor": "white", "complementaryColor": "white",
"themeUrl": "ash.css" "themeURL": "ash.css"
} }

View file

@ -2,5 +2,5 @@
"displayName": "Dark", "displayName": "Dark",
"previewGradient": "45deg, #1f1e1d, #36322b", "previewGradient": "45deg, #1f1e1d, #36322b",
"complementaryColor": "white", "complementaryColor": "white",
"themeUrl": "dark.css" "themeURL": "dark.css"
} }

View file

@ -2,5 +2,5 @@
"displayName": "Light", "displayName": "Light",
"previewGradient": "45deg, #f0ebe8, #d4d0ca", "previewGradient": "45deg, #f0ebe8, #d4d0ca",
"complementaryColor": "black", "complementaryColor": "black",
"themeUrl": "light.css" "themeURL": "light.css"
} }