Split profit colors from "up/Down colors

This commit is contained in:
Matthias 2023-10-18 07:05:33 +02:00
parent 96f81a98c9
commit 202fdf97d9
3 changed files with 15 additions and 13 deletions

View File

@ -86,16 +86,15 @@ const props = defineProps({
type: Object as () => ChartSliderPosition,
default: () => undefined,
},
colorPreference: { required: false, type: String, default: 'greenUp' },
colorUp: { required: false, type: String, default: '#12bb7b' },
colorDown: { required: false, type: String, default: '#ef5350' },
});
// Candle Colors
const colorProfit = props.colorPreference === 'greenUp' ? '#26A69A' : '#EF5350';
const colorLoss = props.colorPreference === 'greenUp' ? '#EF5350' : '#26A69A';
const upColor = colorProfit;
const upBorderColor = colorProfit;
const downColor = colorLoss;
const downBorderColor = colorLoss;
const upColor = props.colorUp;
const upBorderColor = props.colorUp;
const downColor = props.colorDown;
const downBorderColor = props.colorDown;
// Buy / Sell Signal Colors
const buySignalColor = '#00ff26';

View File

@ -65,7 +65,8 @@
:use-u-t-c="settingsStore.timezone === 'UTC'"
:theme="settingsStore.chartTheme"
:slider-position="sliderPosition"
:color-preference="colorStore.colorPreference"
:color-down="colorStore.colorDown"
:color-up="colorStore.colorUp"
>
</CandleChart>
<div v-else class="m-auto">

View File

@ -7,17 +7,19 @@ export const useColorStore = defineStore('colorStore', {
state: () => {
return {
colorPreference: 'greenUp',
colorProfit: '#12bb7b',
colorUp: '#26A69A',
colorDown: '#EF5350',
colorProfit: '#26A69A', //12bb7b
colorLoss: '#ef5350',
};
},
getters: {},
actions: {
updateProfitLossColor() {
const [colorProfit, colorLoss] =
this.colorPreference === 'greenUp' ? ['#12bb7b', '#ef5350'] : ['#ef5350', '#12bb7b'];
this.colorProfit = colorProfit;
this.colorLoss = colorLoss;
const [colorUp, colorDown] =
this.colorPreference === 'greenUp' ? ['#26A69A', '#ef5350'] : ['#ef5350', '#12bb7b'];
this.colorUp = colorUp;
this.colorDown = colorDown;
},
},
persist: {