Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Font color & theming for statement blocks

25 views
Skip to first unread message

Jeremiah Saunders

unread,
Jan 10, 2025, 8:22:53 AMJan 10
to Blockly
I'm using a grayscale theme. I plan on increasing border width with a custom renderer later on.
Screenshot_13.pngScreenshot_14.png
Now, I have a few issues with this. First, the text should be black on all blocks. How can I change the font color?
Additionally, I need statement blocks (like the if block) to have the gray color and non-statement blocks to be white. How should I handle theming specific blocks?

Thank you,
Jeremiah

feni...@google.com

unread,
Jan 22, 2025, 1:12:29 PMJan 22
to Blockly
Hi Jeremiah,

You can set the text colour through CSS with .blocklyText 

The attributes that are part of the font style in the theme (family, weight, and size) change the size of the text, which requires extra care from Blockly to make sure the blocks get rerendered correctly. The colour can just be changed through normal CSS.

To theme specific blocks, you can either use a different style for each block (by providing your own block definition) or, since you're already planning to use a custom renderer, you can make that choice in your rendering code.

Hope this helps, and sorry for the delay.

Rachel
Reply all
Reply to author
Forward
0 new messages