blockly > Block > setStyle
Block.setStyle() method
Set the style and colour values of a block.
Signature:
setStyle(blockStyleName: string): void;
Parameters
Parameter |
Type |
Description |
blockStyleName |
string |
Name of the block style. |
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 `setStyle()` method allows you to change the visual appearance of a block by assigning it a specific style."],["It takes one argument, `blockStyleName`, which is a string representing the name of the desired style."],["Calling `setStyle()` does not return any value (void)."]]],["The `Block.setStyle()` method sets a block's style and color. It accepts one parameter, `blockStyleName`, which is a string representing the desired style's name. This method modifies the block's visual appearance. The method's signature is `setStyle(blockStyleName: string): void;`, indicating it returns nothing after execution. It's used to customize the block's look, using a predefined style name.\n"]]