diff options
author | bobzel <zzzman@gmail.com> | 2025-04-09 11:44:56 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-04-09 11:44:56 -0400 |
commit | 4f236271c39380f15409b8fb38b2f6e2bae8df9f (patch) | |
tree | 01a8842ad4511cacc16f04f08d9fa049849c572b /src/client/views/StyleProvider.tsx | |
parent | 348329448573fcaf18ffc4e1200888e5c38a7d1b (diff) |
cleaned up color setting for templates so that instances can override template default color.
Diffstat (limited to 'src/client/views/StyleProvider.tsx')
-rw-r--r-- | src/client/views/StyleProvider.tsx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index ae94c206c..a1c6aa1a2 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -251,9 +251,11 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & const dataKey = doc ? Doc.LayoutFieldKey(doc) : ""; const usePath = StrCast(doc?.[dataKey + "_usePath"]); const alternate = usePath.includes(":hover") ? ( isHovering?.() ? '_' + usePath.replace(":hover","") : "") : usePath ? "_" +usePath:usePath; - let docColor: Opt<string> = StrCast(doc?.[fieldKey+alternate], StrCast(doc?.['backgroundColor' +alternate], isCaption ? 'rgba(0,0,0,0.4)' : '')); - if (!docColor && doc?.[StrCast(doc?.layout_fieldKey)] instanceof Doc) docColor = StrCast(doc._backgroundColor,docColor); - if (docColor && doc?._override_backgroundColor) docColor = StrCast(doc._backgroundColor,docColor); + let docColor:Opt<string> = StrCast(doc?._backgroundColor, // renderDoc === this.layoutDoc + StrCast(doc?.[fieldKey+alternate], // doc === this.Document + StrCast(doc?.['backgroundColor' +alternate], + isCaption ? 'rgba(0,0,0,0.4)' : ''))); + // prettier-ignore switch (layoutDoc?.type) { case DocumentType.PRESELEMENT: docColor = docColor || ""; break; |