Stay organized with collections
Save and categorize content based on your preferences.
blockly > Theme
Theme class
Class for a theme.
Signature:
export declare class Theme implements ITheme
Implements: ITheme
Constructors
Properties
Property |
Modifiers |
Type |
Description |
name |
|
string |
|
Methods
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eTheme\u003c/code\u003e class in Blockly is used to manage the visual styles and appearance of blocks, categories, and components within the Blockly workspace.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to define, set, and retrieve styles for different elements of the Blockly UI, allowing customization of colors, fonts, and other visual properties.\u003c/p\u003e\n"],["\u003cp\u003eThemes can be created with specific styles for blocks, categories, and components using the constructor or by using the \u003ccode\u003edefineTheme\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003esetBlockStyle\u003c/code\u003e, \u003ccode\u003esetCategoryStyle\u003c/code\u003e, and \u003ccode\u003esetComponentStyle\u003c/code\u003e enable customization of individual elements, while \u003ccode\u003esetFontStyle\u003c/code\u003e and \u003ccode\u003esetStartHats\u003c/code\u003e focus on broader visual aspects of the theme.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [Theme](./blockly.theme_class.md)\n\nTheme class\n-----------\n\nClass for a theme.\n\n**Signature:** \n\n export declare class Theme implements ITheme \n\n**Implements:** ITheme\n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|---------------------------------------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------|\n| [(constructor)(name, opt_blockStyles, opt_categoryStyles, opt_componentStyles)](./blockly.theme_class._constructor__1_constructor.md) | | Constructs a new instance of the `Theme` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|------------------------------------------------|-----------|--------|-------------|\n| [name](./blockly.theme_class.name_property.md) | | string | |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|----------------------------------------------------------------------------------------------------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------|\n| [defineTheme(name, themeObj)](./blockly.theme_class.definetheme_1_method.md) | `static` | Define a new Blockly theme. |\n| [getComponentStyle(componentName)](./blockly.theme_class.getcomponentstyle_1_method.md) | | Gets the style for a given Blockly UI component. If the style value is a string, we attempt to find the value of any named references. |\n| [setBlockStyle(blockStyleName, blockStyle)](./blockly.theme_class.setblockstyle_1_method.md) | | Overrides or adds a style to the blockStyles map. |\n| [setCategoryStyle(categoryStyleName, categoryStyle)](./blockly.theme_class.setcategorystyle_1_method.md) | | Overrides or adds a style to the categoryStyles map. |\n| [setComponentStyle(componentName, styleValue)](./blockly.theme_class.setcomponentstyle_1_method.md) | | Configure a specific Blockly UI component with a style value. |\n| [setFontStyle(fontStyle)](./blockly.theme_class.setfontstyle_1_method.md) | | Configure a theme's font style. |\n| [setStartHats(startHats)](./blockly.theme_class.setstarthats_1_method.md) | | Configure a theme's start hats. |"]]