From e1bb1d667ea32cac9f817e7a994d04fbb0fd40aa Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Fri, 7 Feb 2020 09:20:21 -0800 Subject: [PATCH] Add back setters for theme (#3674) --- core/theme.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/theme.js b/core/theme.js index 802a91f3a..af6d4946a 100644 --- a/core/theme.js +++ b/core/theme.js @@ -51,12 +51,14 @@ Blockly.Theme = function(name, blockStyles, categoryStyles, /** * The block styles map. * @type {!Object.} + * @package */ this.blockStyles = blockStyles; /** * The category styles map. * @type {!Object.} + * @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.