Skip to content

Commit eca2471

Browse files
2 parents 38f77f4 + 7dd52fc commit eca2471

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/colorUtils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ export const blueColorShade = {
9797
80: "#909",
9898
90: "#606",
9999
};
100+
101+
export const transparentColor = 'transparent';
100102

101103
export const limeColorShade = {
102104
20: "#F7FFD1",
@@ -127,6 +129,8 @@ export const getColorForSeeds = (rates: number[], rate: number, varietyIndex: nu
127129
const colorShade = colorMatrix[varietyIndex % colorMatrix.length];
128130
const average = rates.reduce((sum, r) => sum + r, 0) / rates.length;
129131

132+
if(rate === 0){ return transparentColor; }
133+
130134
if (rate === average) return colorShade[50];
131135

132136
if (rate < average) {
@@ -150,7 +154,7 @@ export const getColorForSeeds = (rates: number[], rate: number, varietyIndex: nu
150154
};
151155

152156
export const getColorForBiologicals = (treated: boolean) => {
153-
return treated ? blueColorShade[50] : "transparent";
157+
return treated ? blueColorShade[50] : transparentColor;
154158
};
155159

156160
export const getColorForFertilisers = (rates: number[], rate: number) => {

0 commit comments

Comments
 (0)