Skip to content

Conversation

@ralfstx
Copy link
Member

@ralfstx ralfstx commented Dec 16, 2024

Reading a color property on a row or column block with a nested text block lead to a TypeError:

TypeError: Invalid value for "definition/content/0/rows/0/color":
Expected valid color, got: {type: 'RGB', red: 0, green: 0.3, blue:
0.5}

This happened because the readColor() function transforms the input and did not accept its own result type as input. For nested blocks, the inherited color property is parsed twice if not overwritten.

As a quick fix, this commit changes the readColor() function to accept its own result type, i.e. an object with type RGB.

Fixes #95

Reading a `color` property on a row or column block with a nested text
block lead to a TypeError:

> TypeError: Invalid value for "definition/content/0/rows/0/color":
> Expected valid color, got: {type: 'RGB', red: 0, green: 0.3, blue:
> 0.5}

This happened because the `readColor()` function transforms the input
and did not accept its own result type as input. For nested blocks, the
inherited `color` property is parsed twice if not overwritten.

As a quick fix, this commit changes the `readColor()` function to accept
its own result type, i.e. an object with type `RGB`.

Fixes #95
@ralfstx ralfstx merged commit 07fe0c3 into main Dec 16, 2024
1 check passed
@ralfstx ralfstx deleted the fix-color branch December 16, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError for color on nested blocks

2 participants