IO-1722 replaced hex to rgba
This commit is contained in:
@@ -24,18 +24,15 @@ const cardColor = (ssbuckets, totalHrs) => {
|
||||
bucket.gte <= totalHrs && (!!bucket.lt ? bucket.lt > totalHrs : true)
|
||||
)[0];
|
||||
|
||||
if (bucket.color) {
|
||||
return bucket.color.hex;
|
||||
if (bucket.color.rgb) {
|
||||
return bucket.color.rgb;
|
||||
}
|
||||
|
||||
return "";
|
||||
return bucket.color;
|
||||
};
|
||||
|
||||
function getContrastYIQ(hexColor) {
|
||||
const r = parseInt(hexColor.substr(1, 2), 16);
|
||||
const g = parseInt(hexColor.substr(3, 2), 16);
|
||||
const b = parseInt(hexColor.substr(5, 2), 16);
|
||||
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
||||
function getContrastYIQ(bgColor) {
|
||||
const yiq = (bgColor.r * 299 + bgColor.g * 587 + bgColor.b * 114) / 1000;
|
||||
|
||||
return yiq >= 128 ? "black" : "white";
|
||||
}
|
||||
@@ -85,7 +82,10 @@ export default function ProductionBoardCard(
|
||||
className="react-kanban-card imex-kanban-card"
|
||||
size="small"
|
||||
style={{
|
||||
backgroundColor: cardSettings && cardSettings.cardcolor && bgColor,
|
||||
backgroundColor:
|
||||
cardSettings &&
|
||||
cardSettings.cardcolor &&
|
||||
`rgba(${bgColor.r},${bgColor.g},${bgColor.b},${bgColor.a})`,
|
||||
color:
|
||||
cardSettings && cardSettings.cardcolor && getContrastYIQ(bgColor),
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user