diff --git a/frontend/src/components/Graph/helpers.ts b/frontend/src/components/Graph/helpers.ts new file mode 100644 index 0000000000..c097dcb75d --- /dev/null +++ b/frontend/src/components/Graph/helpers.ts @@ -0,0 +1,8 @@ +import { themeColors } from 'constants/theme'; + +export const getAxisLabelColor = (currentTheme: string): string => { + if (currentTheme === 'light') { + return themeColors.black; + } + return themeColors.whiteCream; +}; diff --git a/frontend/src/components/Graph/index.tsx b/frontend/src/components/Graph/index.tsx index 6c26331e32..fe2b5928e2 100644 --- a/frontend/src/components/Graph/index.tsx +++ b/frontend/src/components/Graph/index.tsx @@ -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); diff --git a/frontend/src/constants/theme.ts b/frontend/src/constants/theme.ts index 96c4bb2983..18f1076cf9 100644 --- a/frontend/src/constants/theme.ts +++ b/frontend/src/constants/theme.ts @@ -33,6 +33,8 @@ const themeColors = { rust: '#B33300', }, errorColor: '#d32f2f', + whiteCream: '#ffffffd5', + black: '#000000', }; export { themeColors };