From a3a5256cf58367238ddbb224483b8ce9cacc4d35 Mon Sep 17 00:00:00 2001 From: Craig Bassett Date: Fri, 5 Mar 2021 17:16:04 -0600 Subject: [PATCH] feat: btn text now properly reacts to background changes Signed-off-by: Craig Bassett --- src/App.vue | 5 +- src/components/AppBar.vue | 4 +- .../cards/settings/ThemeSettingsCard.vue | 26 +++++----- src/components/inputs/Btn.vue | 50 +++++++++++-------- src/components/inputs/BtnToolheadMove.vue | 12 +++-- src/components/widgets/EChartsWidget.vue | 2 +- .../widgets/ToolheadMovesWidget.vue | 10 ++-- src/init.ts | 4 +- src/main.ts | 2 + src/plugins/filters.ts | 10 ++++ src/store/config/getters.ts | 28 +++++++---- src/store/config/index.ts | 4 +- src/store/config/types.ts | 6 ++- 13 files changed, 100 insertions(+), 63 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6ddb3f2e28..cbe5a4cf14 100644 --- a/src/App.vue +++ b/src/App.vue @@ -74,7 +74,6 @@ export default class App extends Mixins(UtilsMixin) { // } mounted () { - this.$vuetify.theme.dark = this.$store.state.config.uiSettings.theme.darkMode EventBus.$on('flashMessage', (payload: FlashMessageType) => { this.flashMessage.text = (payload && payload.text) || undefined this.flashMessage.type = (payload && payload.type) || undefined @@ -110,7 +109,7 @@ export default class App extends Mixins(UtilsMixin) { if (this.printerPrinting) { // Render the progress indicator. const favIconSize = 64 - const primaryColor = theme.colors.primary + const primaryColor = theme.currentTheme.primary const secondaryColor = 'rgba(255, 255, 255, 0.10)' const canvas = document.createElement('canvas') as HTMLCanvasElement const context = canvas.getContext('2d') as CanvasRenderingContext2D @@ -145,7 +144,7 @@ export default class App extends Mixins(UtilsMixin) { } // Build a base64 encoded version of our svg with the correct theme color. - const svg_xml = 'data:image/svg+xml;base64,' + btoa(``) + const svg_xml = 'data:image/svg+xml;base64,' + btoa(``) return { 'link[rel="icon"][sizes="32x32"]': { diff --git a/src/components/AppBar.vue b/src/components/AppBar.vue index 5480b890f8..2720028cdc 100644 --- a/src/components/AppBar.vue +++ b/src/components/AppBar.vue @@ -9,8 +9,8 @@ class="shrink mr-4 mt-1 color-filter" width="35" height="40" - :primary-color="theme.colors.primary" - :secondary-color="theme.colors.primaryOffset" + :primary-color="theme.currentTheme.primary" + :secondary-color="theme.currentTheme.primaryOffset" > {{ color }} --> { this.setTheme({ - darkMode: this.theme.darkMode, - colors: { + isDark: this.theme.isDark, + currentTheme: { primary: value.hex } }) - this.$store.dispatch('config/saveGeneric', { key: 'uiSettings.theme.colors.primary', value: value.hex }) + this.$store.dispatch('config/saveGeneric', { key: 'uiSettings.theme.currentTheme.primary', value: value.hex }) }, 500) handleDarkModeChange (value: boolean) { this.setTheme({ - darkMode: value, - colors: { - primary: this.theme.colors.primary + isDark: value, + currentTheme: { + primary: this.theme.currentTheme.primary } }) - this.$store.dispatch('config/saveGeneric', { key: 'uiSettings.theme.darkMode', value }) + this.$store.dispatch('config/saveGeneric', { key: 'uiSettings.theme.isDark', value }) } handleReset () { const theme: ThemeConfig = { - darkMode: true, - colors: { + isDark: true, + currentTheme: { primary: '#2196F3' } } diff --git a/src/components/inputs/Btn.vue b/src/components/inputs/Btn.vue index 90589c9751..671a8744fd 100644 --- a/src/components/inputs/Btn.vue +++ b/src/components/inputs/Btn.vue @@ -1,18 +1,19 @@