Mooshieblob commited on
Commit
b41074b
·
unverified ·
1 Parent(s): 68ab3de

fix: resolve black (#000000) text color not applying in render controls (#482)

Browse files
ui/components/panels/RenderControlsPanel.tsx CHANGED
@@ -210,7 +210,9 @@ export function RenderControlsPanel() {
210
  ].filter((value): value is FontFaceInfo => !!value),
211
  )
212
  const fallbackFontFaces = fontCandidates.length > 0 ? fontCandidates : DEFAULT_FONT_FACES
213
- const fallbackColor = firstBlock?.style?.color ?? DEFAULT_COLOR
 
 
214
  const fontOptions = fontCandidates
215
  const currentFontCandidate =
216
  selectedBlock?.style?.fontFamilies?.[0] ??
@@ -223,7 +225,9 @@ export function RenderControlsPanel() {
223
  const currentFontFamilyName = currentFontFace?.familyName
224
  const currentEffect = normalizeEffect(selectedBlock?.style?.effect ?? renderEffect)
225
  const currentStroke = normalizeStroke(selectedBlock?.style?.stroke ?? renderStroke)
226
- const currentColor = selectedBlock?.style?.color ?? (hasBlocks ? fallbackColor : DEFAULT_COLOR)
 
 
227
  const currentColorHex = colorToHex(currentColor)
228
  const currentStrokeColorHex = colorToHex(currentStroke.color)
229
  const currentStrokeWidth = currentStroke.widthPx ?? DEFAULT_STROKE_WIDTH
 
210
  ].filter((value): value is FontFaceInfo => !!value),
211
  )
212
  const fallbackFontFaces = fontCandidates.length > 0 ? fontCandidates : DEFAULT_FONT_FACES
213
+ const fallbackColor = firstBlock
214
+ ? resolveStyleColor(firstBlock.style, firstBlock, DEFAULT_COLOR)
215
+ : DEFAULT_COLOR
216
  const fontOptions = fontCandidates
217
  const currentFontCandidate =
218
  selectedBlock?.style?.fontFamilies?.[0] ??
 
225
  const currentFontFamilyName = currentFontFace?.familyName
226
  const currentEffect = normalizeEffect(selectedBlock?.style?.effect ?? renderEffect)
227
  const currentStroke = normalizeStroke(selectedBlock?.style?.stroke ?? renderStroke)
228
+ const currentColor = selectedBlock
229
+ ? resolveStyleColor(selectedBlock.style, selectedBlock, fallbackColor)
230
+ : fallbackColor
231
  const currentColorHex = colorToHex(currentColor)
232
  const currentStrokeColorHex = colorToHex(currentStroke.color)
233
  const currentStrokeWidth = currentStroke.widthPx ?? DEFAULT_STROKE_WIDTH