2022-03-14 17:13:24 +00:00
|
|
|
<template>
|
2022-03-31 21:26:53 +00:00
|
|
|
<client-only>
|
2022-07-06 04:07:12 +00:00
|
|
|
<div class="container-max-height d-flex flex-column justify-end">
|
2022-07-28 21:27:14 +00:00
|
|
|
<!-- ----Color Picker (global, for both)---- -->
|
|
|
|
<v-dialog
|
|
|
|
v-model="pickerState"
|
|
|
|
width="300"
|
|
|
|
content-class="background rounded-lg"
|
|
|
|
>
|
|
|
|
<v-color-picker
|
|
|
|
v-model="$vuetify.theme.currentTheme[pickerMode]"
|
|
|
|
:class="$vuetify.theme.dark ? 'lighten-1' : 'darken-1'"
|
|
|
|
style="min-width: 100%"
|
|
|
|
class="background"
|
|
|
|
hide-mode-switch
|
|
|
|
dot-size="50"
|
|
|
|
mode="hexa"
|
|
|
|
flat
|
|
|
|
/>
|
|
|
|
</v-dialog>
|
|
|
|
<!-- ----Primary Colors---- -->
|
|
|
|
<v-radio-group
|
|
|
|
v-model="$vuetify.theme.currentTheme.primary"
|
|
|
|
style="max-height: 2rem"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="px-6 d-flex flex-row no-wrap align-center"
|
|
|
|
style="max-width: 100%; overflow-x: auto"
|
|
|
|
>
|
|
|
|
<v-radio
|
|
|
|
v-for="color in $vuetify.theme.dark ? primaryDark : primaryLight"
|
|
|
|
:key="color"
|
|
|
|
color="background"
|
|
|
|
on-icon="mdi-check"
|
|
|
|
:light="$vuetify.theme.dark"
|
|
|
|
:dark="!$vuetify.theme.dark"
|
|
|
|
active-class="border-primary"
|
|
|
|
style="transition-duration: 0.3s"
|
|
|
|
:style="{
|
|
|
|
background: color,
|
|
|
|
border: '2px solid ' + color,
|
|
|
|
}"
|
|
|
|
class="mr-2 my-auto rounded-xl"
|
|
|
|
:value="color"
|
|
|
|
/>
|
|
|
|
<!-- Custom Primary -->
|
|
|
|
<v-btn
|
|
|
|
icon
|
|
|
|
class="background"
|
|
|
|
style="height: 1.75rem; width: 1.75rem"
|
|
|
|
:class="$vuetify.theme.dark ? 'lighten-2' : 'darken-2'"
|
|
|
|
v-bind="attrs"
|
|
|
|
v-on="on"
|
|
|
|
@click="(pickerState = true), (pickerMode = 'primary')"
|
|
|
|
>
|
|
|
|
<v-icon>mdi-plus</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
</div>
|
|
|
|
</v-radio-group>
|
2022-05-13 06:20:15 +00:00
|
|
|
<!-- ----Background Colors---- -->
|
2022-03-31 21:26:53 +00:00
|
|
|
<v-radio-group v-model="$vuetify.theme.currentTheme.background">
|
2022-03-30 02:37:54 +00:00
|
|
|
<div
|
2022-07-28 21:27:14 +00:00
|
|
|
class="d-flex flex-row px-2 no-wrap"
|
2022-03-31 21:26:53 +00:00
|
|
|
style="max-width: 100%; overflow-x: auto"
|
2022-03-30 02:37:54 +00:00
|
|
|
>
|
2022-03-31 21:26:53 +00:00
|
|
|
<div
|
|
|
|
v-for="background in $vuetify.theme.dark
|
|
|
|
? backgroundsDark
|
|
|
|
: backgroundsLight"
|
|
|
|
:key="background.color"
|
|
|
|
class="text-center"
|
|
|
|
>
|
|
|
|
<v-radio
|
|
|
|
color="primary"
|
|
|
|
active-class="px-6 border-primary"
|
|
|
|
style="transition-duration: 0.3s"
|
|
|
|
:style="{
|
|
|
|
background: background.color,
|
|
|
|
border: '2px solid ' + background.color,
|
2022-07-28 21:27:14 +00:00
|
|
|
borderRadius: `${$store.state.tweaks.roundTweak / 3}rem`,
|
2022-03-31 21:26:53 +00:00
|
|
|
}"
|
2022-07-28 21:27:14 +00:00
|
|
|
class="py-4 px-4 ma-2"
|
2022-03-31 21:26:53 +00:00
|
|
|
:value="background.color"
|
|
|
|
/>
|
|
|
|
{{ background.name }}
|
|
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
|
|
<v-radio
|
|
|
|
color="primary"
|
|
|
|
active-class="px-6 border-primary primary"
|
|
|
|
style="transition-duration: 0.3s"
|
|
|
|
:style="{
|
|
|
|
background: $vuetify.theme.dark
|
|
|
|
? 'var(--v-primary-darken4) !important'
|
|
|
|
: 'var(--v-primary-lighten4) !important',
|
|
|
|
border: $vuetify.theme.dark
|
|
|
|
? '2px solid var(--v-primary-darken4)'
|
|
|
|
: '2px solid var(--v-primary-lighten4)',
|
2022-07-28 21:27:14 +00:00
|
|
|
borderRadius: `${$store.state.tweaks.roundTweak / 3}rem`,
|
2022-03-31 21:26:53 +00:00
|
|
|
}"
|
2022-07-28 21:27:14 +00:00
|
|
|
class="pa-4 ma-2"
|
2022-05-13 06:20:15 +00:00
|
|
|
:value="$vuetify.theme.dark ? adaptiveDark : adaptiveLight"
|
2022-03-31 21:26:53 +00:00
|
|
|
/>
|
2022-06-15 19:29:52 +00:00
|
|
|
{{ lang.adaptive }}
|
2022-03-31 21:26:53 +00:00
|
|
|
</div>
|
2022-05-13 06:20:15 +00:00
|
|
|
<div class="text-center">
|
|
|
|
<!-- Custom Background -->
|
|
|
|
<v-btn
|
|
|
|
icon
|
2022-07-28 21:27:14 +00:00
|
|
|
class="ma-2 background border-primary"
|
2022-05-13 06:20:15 +00:00
|
|
|
style="height: 3.75rem; width: 3.75rem"
|
2022-07-28 21:27:14 +00:00
|
|
|
:style="{
|
|
|
|
borderRadius: `${$store.state.tweaks.roundTweak / 3}rem`,
|
|
|
|
}"
|
2022-05-13 06:20:15 +00:00
|
|
|
:class="$vuetify.theme.dark ? 'lighten-2' : 'darken-2'"
|
|
|
|
@click="(pickerState = true), (pickerMode = 'background')"
|
|
|
|
>
|
|
|
|
<v-icon>mdi-plus</v-icon>
|
|
|
|
</v-btn>
|
|
|
|
<br />
|
2022-08-08 14:32:58 +00:00
|
|
|
{{ lang.custom }}
|
2022-05-13 06:20:15 +00:00
|
|
|
</div>
|
2022-03-28 19:59:08 +00:00
|
|
|
</div>
|
2022-03-31 21:26:53 +00:00
|
|
|
</v-radio-group>
|
2022-05-13 06:20:15 +00:00
|
|
|
<!-- ----Mode Switch---- -->
|
2022-05-13 22:25:47 +00:00
|
|
|
<v-divider v-if="!$store.state.tweaks.roundTweak" />
|
2022-03-31 21:26:53 +00:00
|
|
|
<v-card
|
|
|
|
flat
|
2022-07-29 04:44:26 +00:00
|
|
|
class="d-flex flex-row mx-4 mb-4 pa-4 background"
|
2022-05-13 06:20:15 +00:00
|
|
|
:class="
|
|
|
|
$store.state.tweaks.roundTweak > 0
|
|
|
|
? $vuetify.theme.dark
|
|
|
|
? 'lighten-1'
|
|
|
|
: 'darken-1'
|
|
|
|
: ''
|
|
|
|
"
|
|
|
|
:style="{
|
2022-07-28 21:27:14 +00:00
|
|
|
borderRadius: `${$store.state.tweaks.roundTweak / 3}rem`,
|
2022-05-13 22:25:47 +00:00
|
|
|
padding: !$store.state.tweaks.roundTweak ? '2rem !important' : '',
|
|
|
|
margin: !$store.state.tweaks.roundTweak ? '0 !important' : '',
|
2022-05-13 06:20:15 +00:00
|
|
|
}"
|
2022-03-31 23:33:39 +00:00
|
|
|
@click="
|
|
|
|
($vuetify.theme.dark = !$vuetify.theme.dark),
|
|
|
|
$vuetube.haptics.hapticsImpactLight(1)
|
|
|
|
"
|
2022-03-31 21:26:53 +00:00
|
|
|
>
|
|
|
|
<div class="my-auto">
|
2022-06-15 19:29:52 +00:00
|
|
|
<div>{{ lang.darkmode }}</div>
|
2022-03-30 02:37:54 +00:00
|
|
|
<div
|
|
|
|
class="background--text"
|
|
|
|
:class="$vuetify.theme.dark ? 'text--lighten-4' : 'text--darken-4'"
|
2022-03-31 21:26:53 +00:00
|
|
|
style="font-size: 0.75rem; margin-top: -0.25rem !important"
|
2022-03-30 02:37:54 +00:00
|
|
|
>
|
2022-06-15 19:29:52 +00:00
|
|
|
{{ lang.darkmodetagline }}
|
2022-03-30 02:37:54 +00:00
|
|
|
</div>
|
2022-03-28 19:59:08 +00:00
|
|
|
</div>
|
2022-03-31 21:26:53 +00:00
|
|
|
<v-spacer />
|
2022-03-31 22:34:09 +00:00
|
|
|
<v-switch
|
|
|
|
v-model="$vuetify.theme.dark"
|
|
|
|
style="pointer-events: none"
|
2022-05-18 04:22:14 +00:00
|
|
|
class="mt-2"
|
2022-03-31 22:34:09 +00:00
|
|
|
inset
|
|
|
|
/>
|
2022-03-31 21:26:53 +00:00
|
|
|
</v-card>
|
|
|
|
</div>
|
|
|
|
</client-only>
|
2022-03-14 17:13:24 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2022-03-15 22:33:16 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2022-10-22 23:34:54 +00:00
|
|
|
primaryLight: ["#6b0406","#E57373", "#34495E", "#6e0ba3","#016a49", "#8b5f37"],
|
2022-03-31 22:34:09 +00:00
|
|
|
primaryDark: [
|
2022-07-28 21:27:14 +00:00
|
|
|
"#dc2626",
|
2022-03-31 22:34:09 +00:00
|
|
|
"#FFBBFF",
|
|
|
|
"#AAAFFF",
|
|
|
|
"#AAFFFF",
|
|
|
|
"#7CD6AF",
|
|
|
|
"#FEC89B",
|
|
|
|
],
|
|
|
|
backgroundsDark: [
|
|
|
|
{ name: "Dark", color: "#181818" },
|
2022-07-28 21:27:14 +00:00
|
|
|
{ name: "Warm", color: "#1c1917" },
|
2022-03-31 22:34:09 +00:00
|
|
|
{ name: "Black", color: "#000000" },
|
|
|
|
],
|
2022-07-28 21:27:14 +00:00
|
|
|
backgroundsLight: [
|
|
|
|
{ name: "Normal", color: "#ffffff" },
|
|
|
|
{ name: "Cold", color: "#e2e8f0" },
|
|
|
|
{ name: "Warm", color: "#e7e5e4" },
|
|
|
|
],
|
2022-05-13 06:20:15 +00:00
|
|
|
adaptiveLight: "",
|
|
|
|
adaptiveDark: "",
|
|
|
|
pickerState: false,
|
|
|
|
pickerMode: "bg",
|
2022-06-22 05:24:06 +00:00
|
|
|
lang: {},
|
2022-03-21 23:47:11 +00:00
|
|
|
};
|
2022-03-15 22:33:16 +00:00
|
|
|
},
|
2022-03-31 04:22:24 +00:00
|
|
|
watch: {
|
2022-03-31 21:26:53 +00:00
|
|
|
// also triggers background and primary watcher, unless primary colors match
|
|
|
|
"$vuetify.theme.dark"(value) {
|
|
|
|
localStorage.setItem("darkTheme", value);
|
2022-03-31 04:22:24 +00:00
|
|
|
},
|
|
|
|
"$vuetify.theme.currentTheme.background"(value) {
|
|
|
|
this.$vuetify.theme.dark
|
|
|
|
? localStorage.setItem("backgroundDark", value)
|
|
|
|
: localStorage.setItem("backgroundLight", value);
|
|
|
|
this.$vuetube.statusBar.setTheme(value, this.$vuetify.theme.dark);
|
|
|
|
this.$vuetube.navigationBar.setTheme(value, !this.$vuetify.theme.dark);
|
2022-05-13 06:20:15 +00:00
|
|
|
// WIP: luma-based light-dark auto-switching
|
|
|
|
// let bg = this.$vuetify.theme.currentTheme.background;
|
|
|
|
// console.log(this.$vuetube.hexToRgb(bg));
|
|
|
|
// let luma =
|
|
|
|
// 0.2126 * this.$vuetube.hexToRgb(bg).r +
|
|
|
|
// 0.7152 * this.$vuetube.hexToRgb(bg).g +
|
|
|
|
// 0.0722 * this.$vuetube.hexToRgb(bg).b;
|
|
|
|
// if (luma < 40) {
|
|
|
|
// this.$vuetify.theme.dark = true;
|
|
|
|
// this.vuetify.theme.currentTheme.background = bg;
|
|
|
|
// }
|
2022-03-31 04:22:24 +00:00
|
|
|
},
|
2022-03-31 21:26:53 +00:00
|
|
|
"$vuetify.theme.currentTheme.primary"(value) {
|
|
|
|
if (value != undefined) {
|
|
|
|
this.$vuetify.theme.dark
|
|
|
|
? localStorage.setItem("primaryDark", value)
|
|
|
|
: localStorage.setItem("primaryLight", value);
|
2022-05-13 06:20:15 +00:00
|
|
|
let tempD = this.adaptiveDark;
|
|
|
|
let tempL = this.adaptiveLight;
|
2022-03-31 21:26:53 +00:00
|
|
|
this.adapt();
|
|
|
|
if (this.$vuetify.theme.currentTheme.background === tempD)
|
2022-05-13 06:20:15 +00:00
|
|
|
this.$vuetify.theme.currentTheme.background = this.adaptiveDark;
|
2022-03-31 21:26:53 +00:00
|
|
|
if (this.$vuetify.theme.currentTheme.background === tempL)
|
2022-05-13 06:20:15 +00:00
|
|
|
this.$vuetify.theme.currentTheme.background = this.adaptiveLight;
|
2022-03-31 21:26:53 +00:00
|
|
|
}
|
2022-03-31 04:22:24 +00:00
|
|
|
},
|
|
|
|
},
|
2022-07-06 04:07:12 +00:00
|
|
|
mounted() {
|
|
|
|
this.lang = this.$lang("mods").theme;
|
2022-07-28 21:27:14 +00:00
|
|
|
// TODO: loop, and fill the missing colors, otherwise it breaks
|
|
|
|
// this.backgroundsLight[0].name = this.lang.normal;
|
|
|
|
// this.backgroundsDark[0].name = this.lang.dark;
|
|
|
|
// this.backgroundsDark[1].name = this.lang.black;
|
2022-07-06 04:07:12 +00:00
|
|
|
},
|
2022-03-31 21:26:53 +00:00
|
|
|
beforeMount() {
|
|
|
|
this.adapt();
|
|
|
|
},
|
2022-03-31 04:22:24 +00:00
|
|
|
methods: {
|
|
|
|
adapt() {
|
2022-03-31 22:34:09 +00:00
|
|
|
let hexD = getComputedStyle(document.documentElement).getPropertyValue(
|
|
|
|
"--v-primary-darken4"
|
|
|
|
);
|
|
|
|
let hexL = getComputedStyle(document.documentElement).getPropertyValue(
|
|
|
|
"--v-primary-lighten4"
|
|
|
|
);
|
2022-03-30 02:37:54 +00:00
|
|
|
// the menace above returns a hex string with A SPACE " " in front of it, that's why substring(1)
|
2022-03-31 04:22:24 +00:00
|
|
|
// the SPACE " " is stored as part of the CSS variable itself to be used for chaining
|
2022-05-13 06:20:15 +00:00
|
|
|
this.adaptiveDark = hexD.substring(1).toUpperCase();
|
|
|
|
this.adaptiveLight = hexL.substring(1).toUpperCase();
|
2022-03-31 21:26:53 +00:00
|
|
|
setTimeout(() => {
|
2022-03-31 22:34:09 +00:00
|
|
|
if (
|
|
|
|
this.$vuetify.theme.currentTheme.background ==
|
|
|
|
hexD.substring(1).toUpperCase()
|
|
|
|
)
|
2022-05-13 06:20:15 +00:00
|
|
|
this.$vuetify.theme.currentTheme.background = this.adaptiveDark;
|
2022-03-31 22:34:09 +00:00
|
|
|
if (
|
|
|
|
this.$vuetify.theme.currentTheme.background ==
|
|
|
|
hexL.substring(1).toUpperCase()
|
|
|
|
)
|
2022-05-13 06:20:15 +00:00
|
|
|
this.$vuetify.theme.currentTheme.background = this.adaptiveLight;
|
2022-03-31 21:26:53 +00:00
|
|
|
}, 0);
|
2022-03-31 04:22:24 +00:00
|
|
|
},
|
2022-03-21 23:47:11 +00:00
|
|
|
},
|
|
|
|
};
|
2022-03-14 17:13:24 +00:00
|
|
|
</script>
|