0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-01 09:22:39 +00:00
VueTube/NUXT/pages/mods/theme.vue

124 lines
3.1 KiB
Vue
Raw Normal View History

2022-03-14 17:13:24 +00:00
<template>
<div class="py-1">
2022-03-14 17:13:24 +00:00
<v-card class="pb-5">
2022-03-14 17:24:47 +00:00
<v-card-title>Global Base Color</v-card-title>
2022-03-14 17:13:24 +00:00
<v-row class="ml-3 mr-6">
<section class="row">
<v-switch
v-model="$vuetify.theme.dark"
label="Dark Theme"
hint="Bravo Six, Going Dark."
persistent-hint
inset
@click="saveTheme($vuetify.theme.dark)"
/>
</section>
2022-03-21 23:47:11 +00:00
<v-btn
v-if="$vuetify.theme.dark"
text
tile
class="white--text black"
@click="amoled"
>
2022-03-14 17:13:24 +00:00
{{
2022-03-21 23:47:11 +00:00
$vuetify.theme.themes.dark.background === "#000" ? "LCD" : "OLED"
2022-03-14 17:13:24 +00:00
}}
2022-03-21 23:47:11 +00:00
<v-icon
:size="
$vuetify.theme.themes.dark.background === '#000'
? '.5rem'
: '.9rem'
"
class="ml-2"
>mdi-brightness-2</v-icon
>
2022-03-14 17:13:24 +00:00
</v-btn>
</v-row>
</v-card>
2022-03-15 22:33:16 +00:00
<v-card class="pb-5">
<v-card-title>Accent Color</v-card-title>
<v-card-text>
2022-03-21 23:47:11 +00:00
<v-alert color="primary" dense outlined type="warning"
>NOTE: This doesn't save after closing the app (yet)</v-alert
>
<v-color-picker
v-model="accentColor"
dot-size="5"
hide-mode-switch
mode="hexa"
/>
2022-03-15 22:33:16 +00:00
</v-card-text>
</v-card>
2022-03-14 17:13:24 +00:00
</div>
</template>
<script>
export default {
2022-03-15 22:33:16 +00:00
data() {
return {
2022-03-21 23:47:11 +00:00
accentColor: "#ffffff",
};
2022-03-15 22:33:16 +00:00
},
watch: {
2022-03-21 23:47:11 +00:00
accentColor: function (val) {
2022-03-22 00:52:45 +00:00
this.$vuetify.theme.currentTheme.primary.base = val;
2022-03-18 11:49:47 +00:00
let primaryAlt = this.$vuetube.hexToRgb(val);
2022-03-15 22:33:16 +00:00
2022-03-16 00:13:26 +00:00
let rgbEdit = 130; //Light Mode
2022-03-21 23:47:11 +00:00
if (localStorage.getItem("darkTheme") === "true") rgbEdit = -80; //Dark Mode
2022-03-16 00:13:26 +00:00
2022-03-15 22:33:16 +00:00
for (const i in primaryAlt) {
2022-03-16 00:13:26 +00:00
primaryAlt[i] = primaryAlt[i] + rgbEdit; //Amount To Lighten By
2022-03-15 22:33:16 +00:00
if (primaryAlt[i] > 255) primaryAlt[i] = 255;
2022-03-16 00:13:26 +00:00
if (primaryAlt[i] < 0) primaryAlt[i] = 0;
2022-03-15 22:33:16 +00:00
}
2022-03-21 23:47:11 +00:00
primaryAlt = this.$vuetube.rgbToHex(
primaryAlt.r,
primaryAlt.g,
primaryAlt.b
);
2022-03-15 22:33:16 +00:00
2022-03-22 00:52:45 +00:00
this.$vuetify.theme.currentTheme.primary.lighten2 = primaryAlt;
2022-03-21 23:47:11 +00:00
},
},
2022-03-15 22:33:16 +00:00
2022-03-21 23:47:11 +00:00
mounted() {
2022-03-22 00:52:45 +00:00
this.accentColor = this.$vuetify.theme.themes.dark.primary.base;
2022-03-21 23:47:11 +00:00
this.roblox = localStorage.getItem("roblox") === "true";
},
methods: {
amoled() {
this.$vuetify.theme.themes.dark.background === "#000"
? ((this.$vuetify.theme.themes.dark.accent = "#222"),
2022-03-22 00:52:45 +00:00
(this.$vuetify.theme.themes.dark.accent = "#222"),
2022-03-21 23:47:11 +00:00
(this.$vuetify.theme.themes.dark.background = "#333"),
localStorage.setItem("isOled", false))
: ((this.$vuetify.theme.themes.dark.accent = "#000"),
2022-03-22 00:52:45 +00:00
(this.$vuetify.theme.themes.dark.accent = "#000"),
2022-03-21 23:47:11 +00:00
(this.$vuetify.theme.themes.dark.background = "#000"),
localStorage.setItem("isOled", true));
},
saveTheme(isDark) {
this.$vuetube.statusBar.setBackground(
this.$vuetify.theme.currentTheme.accent
);
localStorage.setItem("darkTheme", isDark);
},
},
};
2022-03-14 17:13:24 +00:00
</script>
<style scoped>
.v-card {
margin: 1em;
}
section {
padding: 0 1em 1em 1em;
}
</style>