IO-1722 adjusted background colors
This commit is contained in:
@@ -2,12 +2,21 @@ import { Col, List, Space, Typography } from "antd";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const CardColorLegend = ({ bodyshop, cardSettings }) => {
|
const CardColorLegend = ({ bodyshop }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const data = bodyshop.ssbuckets.map((size) => ({
|
const data = bodyshop.ssbuckets.map((bucket) => {
|
||||||
label: size.label,
|
let color = { r: 255, g: 255, b: 255 };
|
||||||
color: size.color?.hex ?? "white",
|
|
||||||
}));
|
if (bucket.color.rgb) {
|
||||||
|
color = bucket.color.rgb;
|
||||||
|
}
|
||||||
|
color = bucket.color; // default to white
|
||||||
|
|
||||||
|
return {
|
||||||
|
label: bucket.label,
|
||||||
|
color,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col>
|
<Col>
|
||||||
@@ -24,7 +33,7 @@ const CardColorLegend = ({ bodyshop, cardSettings }) => {
|
|||||||
style={{
|
style={{
|
||||||
width: "1.5rem",
|
width: "1.5rem",
|
||||||
aspectRatio: "1/1",
|
aspectRatio: "1/1",
|
||||||
backgroundColor: item.color,
|
backgroundColor: `rgba(${item.color.r},${item.color.g},${item.color.b},${item.color.a})`,
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
<div>{item.label}</div>
|
<div>{item.label}</div>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const cardColor = (ssbuckets, totalHrs) => {
|
|||||||
return bucket.color.rgb;
|
return bucket.color.rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bucket.color;
|
return bucket.color ?? { r: 255, g: 255, b: 255 }; // default to white
|
||||||
};
|
};
|
||||||
|
|
||||||
function getContrastYIQ(bgColor) {
|
function getContrastYIQ(bgColor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user