fix: Changed axis label color (#2080)

* fix: Changed axis label color

* fix: linting issues

* chore: helpers is updated

Co-authored-by: Palash Gupta <palashgdev@gmail.com>
This commit is contained in:
Chintan Sudani 2023-01-18 19:40:15 +05:30 committed by GitHub
parent 1e39131c38
commit fa652be926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,8 @@
import { themeColors } from 'constants/theme';
export const getAxisLabelColor = (currentTheme: string): string => {
if (currentTheme === 'light') {
return themeColors.black;
}
return themeColors.whiteCream;
};

View File

@ -27,6 +27,7 @@ import { useIsDarkMode } from 'hooks/useDarkMode';
import React, { useCallback, useEffect, useRef } from 'react';
import { hasData } from './hasData';
import { getAxisLabelColor } from './helpers';
import { legend } from './Plugin';
import {
createDragSelectPlugin,
@ -200,6 +201,7 @@ function Graph({
},
},
type: 'time',
ticks: { color: getAxisLabelColor(currentTheme) },
},
y: {
display: true,
@ -208,6 +210,7 @@ function Graph({
color: getGridColor(),
},
ticks: {
color: getAxisLabelColor(currentTheme),
// Include a dollar sign in the ticks
callback(value) {
return getYAxisFormattedValue(value.toString(), yAxisUnit);

View File

@ -33,6 +33,8 @@ const themeColors = {
rust: '#B33300',
},
errorColor: '#d32f2f',
whiteCream: '#ffffffd5',
black: '#000000',
};
export { themeColors };