From abed6f8868333d6be294be093c3d782f8e912ec7 Mon Sep 17 00:00:00 2001 From: qiweiii Date: Sun, 16 Jul 2023 14:11:40 +0800 Subject: [PATCH] feat: add color preference setting --- src/App.vue | 9 +++++++ src/components/charts/CandleChart.vue | 27 +++++++++++-------- .../charts/CandleChartContainer.vue | 1 + src/components/charts/CumProfitChart.vue | 5 ++-- src/components/charts/DailyChart.vue | 4 +-- src/components/charts/HourlyChart.vue | 4 +-- src/components/charts/TradesLog.vue | 4 +-- src/shared/colorPreference.ts | 7 +++++ src/stores/settings.ts | 9 +++++++ src/styles/_variables.scss | 10 +++++-- src/views/SettingsView.vue | 12 +++++++++ 11 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 src/shared/colorPreference.ts diff --git a/src/App.vue b/src/App.vue index c05c42fd..822bd110 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,11 +11,14 @@ import NavBar from '@/components/layout/NavBar.vue'; import NavFooter from '@/components/layout/NavFooter.vue'; import BodyLayout from '@/components/layout/BodyLayout.vue'; import { setTimezone } from './shared/formatters'; +import { setProfitLossColorsCSS } from './shared/colorPreference'; import { onMounted, watch } from 'vue'; import { useSettingsStore } from './stores/settings'; const settingsStore = useSettingsStore(); onMounted(() => { setTimezone(settingsStore.timezone); + setProfitLossColorsCSS(settingsStore.colorPreference); + settingsStore.updateProfitLossColor(); }); watch( () => settingsStore.timezone, @@ -24,6 +27,12 @@ watch( setTimezone(tz); }, ); +watch( + () => settingsStore.colorPreference, + (preference) => { + setProfitLossColorsCSS(preference); + }, +);