Class: Theme
Defined in: packages/blockly/core/theme.ts:30
Class for a theme.
Implements
ITheme
Properties index
| Property | Description |
|---|---|
| name | Theme name. |
Methods index
| Method | Description |
|---|---|
| setBlockStyle | Overrides or adds a style to the blockStyles map. |
| setCategoryStyle | Overrides or adds a style to the categoryStyles map. |
| getComponentStyle | 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. |
| setComponentStyle | Configure a specific Blockly UI component with a style value. |
| setFontStyle | Configure a theme's font style. |
| setStartHats | Configure a theme's start hats. |
| defineTheme | Define a new Blockly theme. |
Constructors
Constructor
new Theme(
name,
opt_blockStyles?,
opt_categoryStyles?,
opt_componentStyles?
): Theme;
Defined in: packages/blockly/core/theme.ts:56
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | Theme name. |
opt_blockStyles? | { [key: string]: Partial<BlockStyle>; } | A map from style names (strings) to objects with style attributes for blocks. |
opt_categoryStyles? | { [key: string]: CategoryStyle; } | A map from style names (strings) to objects with style attributes for categories. |
opt_componentStyles? | ComponentStyle | A map of Blockly component names to style value. |
Returns
Theme
Properties
name
name: string;
Defined in: packages/blockly/core/theme.ts:57
Theme name.
Implementation of
ITheme.name
Methods
setBlockStyle()
setBlockStyle(blockStyleName, blockStyle): void;
Defined in: packages/blockly/core/theme.ts:95
Overrides or adds a style to the blockStyles map.
Parameters
| Parameter | Type | Description |
|---|---|---|
blockStyleName | string | The name of the block style. |
blockStyle | BlockStyle | The block style. |
Returns
void
setCategoryStyle()
setCategoryStyle(categoryStyleName, categoryStyle): void;
Defined in: packages/blockly/core/theme.ts:105
Overrides or adds a style to the categoryStyles map.
Parameters
| Parameter | Type | Description |
|---|---|---|
categoryStyleName | string | The name of the category style. |
categoryStyle | CategoryStyle | The category style. |
Returns
void
getComponentStyle()
getComponentStyle(componentName): string | null;
Defined in: packages/blockly/core/theme.ts:116
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
componentName | string | The name of the component. |
Returns
string | null
The style value.
setComponentStyle()
setComponentStyle(componentName, styleValue): void;
Defined in: packages/blockly/core/theme.ts:136
Configure a specific Blockly UI component with a style value.
Parameters
| Parameter | Type | Description |
|---|---|---|
componentName | string | The name of the component. |
styleValue | any | The style value. |
Returns
void
setFontStyle()
setFontStyle(fontStyle): void;
Defined in: packages/blockly/core/theme.ts:145
Configure a theme's font style.
Parameters
| Parameter | Type | Description |
|---|---|---|
fontStyle | FontStyle | The font style. |
Returns
void
setStartHats()
setStartHats(startHats): void;
Defined in: packages/blockly/core/theme.ts:154
Configure a theme's start hats.
Parameters
| Parameter | Type | Description |
|---|---|---|
startHats | boolean | True if the theme enables start hats, false otherwise. |
Returns
void
defineTheme()
static defineTheme(name, themeObj): Theme;
Defined in: packages/blockly/core/theme.ts:165
Define a new Blockly theme.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The name of the theme. |
themeObj | ITheme | An object containing theme properties. |
Returns
Theme
A new Blockly theme.