You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
547 B
20 lines
547 B
|
|
export const COLOR_VERY_BAD = "#F66";
|
|
export const COLOR_BAD = "#FBB";
|
|
export const COLOR_NEUTRAL = "#FFF";
|
|
export const COLOR_GOOD = "#BFB";
|
|
export const COLOR_VERY_GOOD = "#6F6";
|
|
|
|
export const COLOR_STONKS_GOOD = "#3A3";
|
|
|
|
export const colorByDiff = (diff, prevDiff, stonksDiff = 0) => {
|
|
if (stonksDiff > 0 && stonksDiff > prevDiff && diff > stonksDiff) {
|
|
return COLOR_STONKS_GOOD;
|
|
}
|
|
|
|
if (diff < 0) {
|
|
return diff < prevDiff ? COLOR_VERY_BAD : COLOR_BAD;
|
|
} else {
|
|
return diff > prevDiff ? COLOR_VERY_GOOD : COLOR_GOOD;
|
|
}
|
|
};
|