google/blockly

Make blocks inherit category color

Closed this issue · 1 comments

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

Blocks without a defined color are black by default.

Request

Make blocks that have no defined color inherit the color of their category.

Alternatives considered

No response

Additional context

No response

Hi,

Thank you for the suggestion. However, it will not be feasible to implement. Block definitions only define the block itself and do not have an inherent toolbox category associated with them. The toolbox category and its contents are defined by the toolbox definition and that is the only way blocks are associated with categories. A block may appear in multiple toolbox categories or none at all. The same block definition may be used in multiple applications with different toolbox categories.

If you'd like to style multiple blocks at once without specifying an explicit color, you can use the theme system. Themes are a way to define a style once and apply it to blocks by name, which is similar to what you're proposing here.