mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Add back setters for theme (#3674)
This commit is contained in:
@@ -51,12 +51,14 @@ Blockly.Theme = function(name, blockStyles, categoryStyles,
|
||||
/**
|
||||
* The block styles map.
|
||||
* @type {!Object.<string, !Blockly.Theme.BlockStyle>}
|
||||
* @package
|
||||
*/
|
||||
this.blockStyles = blockStyles;
|
||||
|
||||
/**
|
||||
* The category styles map.
|
||||
* @type {!Object.<string, Blockly.Theme.CategoryStyle>}
|
||||
* @package
|
||||
*/
|
||||
this.categoryStyles = categoryStyles;
|
||||
|
||||
@@ -87,6 +89,25 @@ Blockly.Theme.BlockStyle;
|
||||
*/
|
||||
Blockly.Theme.CategoryStyle;
|
||||
|
||||
/**
|
||||
* Overrides or adds a style to the blockStyles map.
|
||||
* @param {string} blockStyleName The name of the block style.
|
||||
* @param {Blockly.Theme.BlockStyle} blockStyle The block style.
|
||||
*/
|
||||
Blockly.Theme.prototype.setBlockStyle = function(blockStyleName, blockStyle) {
|
||||
this.blockStyles[blockStyleName] = blockStyle;
|
||||
};
|
||||
|
||||
/**
|
||||
* Overrides or adds a style to the categoryStyles map.
|
||||
* @param {string} categoryStyleName The name of the category style.
|
||||
* @param {Blockly.Theme.CategoryStyle} categoryStyle The category style.
|
||||
*/
|
||||
Blockly.Theme.prototype.setCategoryStyle = function(categoryStyleName,
|
||||
categoryStyle) {
|
||||
this.categoryStyles[categoryStyleName] = categoryStyle;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
||||
Reference in New Issue
Block a user