blockly > Block > setColour
Block.setColour() method
Change the colour of a block.
Signature:
setColour(colour: number | string): void;
Parameters
Parameter |
Type |
Description |
colour |
number | string |
HSV hue value (0 to 360), #RRGGBB string, or a message reference string pointing to one of those two values. |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `Block.setColour()` method is used to change the color of a block in Blockly."],["You can specify the color using an HSV hue value (0-360), a hexadecimal color code (#RRGGBB), or a message reference string."],["Calling this method does not return any value (void)."]]],["The `Block.setColour()` method modifies a block's color. It accepts a single `colour` parameter, which can be a numeric HSV hue value (0-360), an HTML-style hexadecimal color code (`#RRGGBB`), or a string referencing one of those two. The method does not return any value (void). This allows for dynamic color changes within the block interface using different color formats.\n"]]