blockly > Field > applyColour
Field.applyColour() method
Updates the field to match the colour/style of the block.
Non-abstract sub-classes may wish to implement this if the colour of the field depends on the colour of the block. It will automatically be called at relevant times, such as when the parent block or renderer changes.
See the field documentation for more information, or FieldDropdown for an example.
Signature:
applyColour(): void;
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 `applyColour()` method updates a field's color to match its parent block."],["Subclasses of `Field` can implement this method to customize how their color is affected by the block's color."],["It's automatically called when the block or renderer's color changes, ensuring the field's color remains consistent."],["Refer to the field documentation or the `FieldDropdown` class for implementation examples."]]],["The `Field.applyColour()` method updates a field to match the color or style of its parent block. Subclasses can implement this method if the field's appearance depends on the block's color. This method is automatically called when the parent block or renderer changes. It takes no arguments and returns nothing (`void`). Detailed information can be found in the field documentation, with `FieldDropdown` as a practical example.\n"]]