From e3b89ec75df48e4a66a87bf12aa0ff1ccdcaa3c1 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Fri, 30 Oct 2020 21:20:53 -0600 Subject: [PATCH] Completely rework the way icon theming is done so that they update with the theme changes --- src/components/Icon.vue | 32 +++++++++++++++++++++------- src/components/cards/Artist.vue | 4 ++-- src/components/cards/Track.vue | 16 +++++++------- src/components/modals/ThemeModal.vue | 3 ++- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/components/Icon.vue b/src/components/Icon.vue index 325f892..b547074 100644 --- a/src/components/Icon.vue +++ b/src/components/Icon.vue @@ -16,10 +16,11 @@ ry="0" /> @@ -39,10 +40,11 @@ ry="0" /> @@ -59,10 +61,11 @@ ry="0" /> @@ -82,9 +85,11 @@ ry="0" /> @@ -104,10 +109,11 @@ ry="0" /> @@ -124,12 +130,12 @@ export default { }, primary: { type: String, - default: `#FFFFFF`, + default: `--icon-primary`, required: false, }, secondary: { type: String, - default: `#FFFFFF`, + default: `--icon-secondary`, required: false, }, size: { @@ -155,7 +161,7 @@ export default { }, data() { return { div_styles: { - "background-color": this.background, + "background-color": this.background ? `var(${this.background})` : null, "border-radius": `${this.border}px`, "width": `${this.size}px`, "height": `${this.size}px`, @@ -174,6 +180,16 @@ export default { width: `${x}px`, height: `${x}px`, } + }, + primary_styles() { + return { + "fill": `var(${this.primary})`, + }; + }, + secondary_styles() { + return { + "fill": `var(${this.secondary})` + } } } } diff --git a/src/components/cards/Artist.vue b/src/components/cards/Artist.vue index dc116b7..96dcf38 100644 --- a/src/components/cards/Artist.vue +++ b/src/components/cards/Artist.vue @@ -11,8 +11,8 @@ type="notes" :size="230" :border="115" - :primary="css_var('--missing-picture-foreground')" - :background="css_var('--missing-picture-background')" + :primary="'--missing-picture-foreground'" + :background="'--missing-picture-background'" />
diff --git a/src/components/cards/Track.vue b/src/components/cards/Track.vue index 382814d..6fd5a6d 100644 --- a/src/components/cards/Track.vue +++ b/src/components/cards/Track.vue @@ -11,8 +11,8 @@ type="notes" :size="200" :border="100" - :primary="css_var('--missing-picture-foreground')" - :background="css_var('--missing-picture-background')" + :primary="'--missing-picture-foreground'" + :background="'--missing-picture-background'" />
@@ -23,41 +23,41 @@
{{ duration }}
diff --git a/src/components/modals/ThemeModal.vue b/src/components/modals/ThemeModal.vue index 3a44f07..4530c05 100644 --- a/src/components/modals/ThemeModal.vue +++ b/src/components/modals/ThemeModal.vue @@ -86,7 +86,8 @@ export default { }, watch: { chosen_theme(val) { - document.getElementById(`theme`).href = `` + localStorage.setItem(`tl-theme`, val); + document.getElementById(`theme`).href = `/static/css/theme/${val}.css`; } }, }