From 9908aa85d833d51022c3eb340e29b321e420f030 Mon Sep 17 00:00:00 2001 From: celine Date: Thu, 17 Jul 2025 16:18:42 -0400 Subject: [PATCH] the last commit didn't actually do what i said it did, this one does lol --- components/ThemeManager/ThemeProvider.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/ThemeManager/ThemeProvider.tsx b/components/ThemeManager/ThemeProvider.tsx index 6c027f97..75175b11 100644 --- a/components/ThemeManager/ThemeProvider.tsx +++ b/components/ThemeManager/ThemeProvider.tsx @@ -88,6 +88,10 @@ export function LeafletThemeProvider(props: { }) { let bgLeaflet = useColorAttribute(props.entityID, "theme/page-background"); let bgPage = useColorAttribute(props.entityID, "theme/card-background"); + let showPageBackground = !useEntity( + props.entityID, + "theme/card-border-hidden", + )?.data.value; let primary = useColorAttribute(props.entityID, "theme/primary"); let highlight1 = useEntity(props.entityID, "theme/highlight-1"); @@ -99,8 +103,14 @@ export function LeafletThemeProvider(props: { // set accent contrast to the accent color that has the highest contrast with the page background let accentContrast = [accent1, accent2].sort((a, b) => { return ( - getColorContrast(colorToString(b, "rgb"), colorToString(bgPage, "rgb")) - - getColorContrast(colorToString(a, "rgb"), colorToString(bgPage, "rgb")) + getColorContrast( + colorToString(b, "rgb"), + colorToString(showPageBackground ? bgPage : bgLeaflet, "rgb"), + ) - + getColorContrast( + colorToString(a, "rgb"), + colorToString(showPageBackground ? bgPage : bgLeaflet, "rgb"), + ) ); })[0]; -- 2.51.2