0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2025-01-05 07:01:14 +00:00

dark mode optimizations (beta 2)

This commit is contained in:
Front 2022-03-15 20:13:26 -04:00
parent defcfc2ca2
commit acc30a6e6a
3 changed files with 15 additions and 13 deletions

View file

@ -1,7 +1,7 @@
<template>
<v-bottom-navigation v-model="tabSelection" shift class="bottomNav py-4 accent2">
<v-btn v-for="(item, i) in tabs" :key="i" rounded class="navButton" :to="item.link" plain v-ripple="false">
<v-btn v-for="(item, i) in tabs" :key="i" class="navButton" :to="item.link" plain v-ripple="false">
<span v-text="item.name" />
<v-icon v-text="item.icon" :color="tabSelection == i ? 'primary' : 'grey'" :class="tabSelection == i ? 'tab primaryAlt' : ''" />

View file

@ -44,12 +44,12 @@ export default {
data() {
return {
accentColor: '#ffffff',
accentColor: '#ffffff'
}
},
mounted() {
//this.accentColor = this.$vuetify.theme.themes.dark.primary;
this.accentColor = this.$vuetify.theme.themes.dark.primary;
},
methods: {
@ -78,13 +78,15 @@ export default {
watch: {
accentColor: function (val, oldVal) {
this.$vuetify.theme.currentTheme.primary = val;
let primaryAlt = this.$libs.hexToRgb(val);
let rgbEdit = 130; //Light Mode
if (localStorage.getItem('darkTheme') === "true") rgbEdit = -80; //Dark Mode
for (const i in primaryAlt) {
primaryAlt[i] = primaryAlt[i] + 100; //Amount To Lighten By
primaryAlt[i] = primaryAlt[i] + rgbEdit; //Amount To Lighten By
if (primaryAlt[i] > 255) primaryAlt[i] = 255;
if (primaryAlt[i] < 0) primaryAlt[i] = 0;
}
primaryAlt = this.$libs.rgbToHex(primaryAlt.r, primaryAlt.g, primaryAlt.b);

View file

@ -1,16 +1,16 @@
const module = {
hexToRgb: function (hex, callback) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
},
rgbToHex: function(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}