New: Move to CSS Variables for Colorings

This commit is contained in:
Qstick
2021-11-21 17:00:02 -06:00
parent 8d39d5c6bb
commit 2b58f3131e
90 changed files with 354 additions and 547 deletions
@@ -1,7 +1,12 @@
import Chart from 'chart.js/auto';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import colors from 'Styles/Variables/colors';
function getColors(index) {
const style = getComputedStyle(document.body);
return style.getPropertyValue('--chartColorsDiversified').split(',')[index];
}
class StackedBarChart extends Component {
constructor(props) {
@@ -41,7 +46,7 @@ class StackedBarChart extends Component {
return {
label: d.label,
data: d.data,
backgroundColor: colors.chartColorsDiversified[index]
backgroundColor: getColors(index)
};
})
}
@@ -54,7 +59,7 @@ class StackedBarChart extends Component {
return {
label: d.label,
data: d.data,
backgroundColor: colors.chartColorsDiversified[index]
backgroundColor: getColors(index)
};
});
this.myChart.update();