mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
refactor dark mode checks (#2407)
The current method for checking light vs. dark mode is to compare the name of the theme against a hardcoded string. This PR uses a dark mode boolean. This change is for verbosity and so that we're not reliant on theme name. Additionally, we change some references to colors to the global theme, instead of indexing the list of themes.
This commit is contained in:
@@ -53,9 +53,9 @@ const getOptions = (data: ChartData[] = []) => {
|
||||
|
||||
return `${tooltip}</div>`;
|
||||
},
|
||||
backgroundColor: theme.themes.value[theme.global.name.value].colors.background,
|
||||
backgroundColor: theme.global.current.value.colors.background,
|
||||
textStyle: {
|
||||
color: theme.themes.value[theme.global.name.value].colors.onBackground
|
||||
color: theme.global.current.value.colors.onBackground
|
||||
},
|
||||
axisPointer: {
|
||||
animation: false
|
||||
@@ -149,10 +149,9 @@ const getSeries = (data: ChartData[] = []) => {
|
||||
: null,
|
||||
lineStyle: {
|
||||
width: 1.5,
|
||||
color:
|
||||
theme.global.name.value === "LightTheme"
|
||||
? theme.themes.value[theme.global.name.value].colors.primary
|
||||
: `rgb(${color.r}, ${color.g}, ${color.b})`
|
||||
color: theme.global.current.value.dark
|
||||
? `rgb(${color.r}, ${color.g}, ${color.b})`
|
||||
: theme.global.current.value.colors.primary
|
||||
},
|
||||
areaStyle: {
|
||||
color: {
|
||||
@@ -164,17 +163,15 @@ const getSeries = (data: ChartData[] = []) => {
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0,
|
||||
color:
|
||||
theme.global.name.value === "LightTheme"
|
||||
? `${theme.themes.value[theme.global.name.value].colors.primary}40`
|
||||
: `rgba(${color.r}, ${color.g}, ${color.b}, 0.15)`
|
||||
color: theme.global.current.value.dark
|
||||
? `rgba(${color.r}, ${color.g}, ${color.b}, 0.15)`
|
||||
: `${theme.global.current.value.colors.primary}40`
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color:
|
||||
theme.global.name.value === "LightTheme"
|
||||
? `${theme.themes.value[theme.global.name.value].colors.primary}40`
|
||||
: `rgba(${color.r}, ${color.g}, ${color.b}, 0.15)`
|
||||
color: theme.global.current.value.dark
|
||||
? `rgba(${color.r}, ${color.g}, ${color.b}, 0.15)`
|
||||
: `${theme.global.current.value.colors.primary}40`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user