From 130297f795958bea516c250f957fb1daf7725653 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Wed, 22 Jan 2020 07:34:46 -0800 Subject: [PATCH] Add colour methods back to blockSvg (#3626) * Add colour methods back to blockSvg --- core/block_svg.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/core/block_svg.js b/core/block_svg.js index 338db0d15..d42f5018c 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -218,6 +218,49 @@ Blockly.BlockSvg.prototype.initSvg = function() { } }; +/** + * Get the secondary colour of a block. + * @return {?string} #RRGGBB string. + */ +Blockly.BlockSvg.prototype.getColourSecondary = function() { + return this.style.colourSecondary; +}; + +/** + * Get the tertiary colour of a block. + * @return {?string} #RRGGBB string. + */ +Blockly.BlockSvg.prototype.getColourTertiary = function() { + return this.style.colourTertiary; +}; + +/** + * Get the shadow colour of a block. + * @return {?string} #RRGGBB string. + * @deprecated Use style.colourSecondary. (2020 January 21) + */ +Blockly.BlockSvg.prototype.getColourShadow = function() { + return this.getColourSecondary(); +}; + +/** + * Get the border colour(s) of a block. + * @return {{colourDark, colourLight, colourBorder}} An object containing + * colour values for the border(s) of the block. If the block is using a + * style the colourBorder will be defined and equal to the tertiary colour + * of the style (#RRGGBB string). Otherwise the colourDark and colourLight + * attributes will be defined (#RRGGBB strings). + * @deprecated Use style.colourTertiary. (2020 January 21) + */ +Blockly.BlockSvg.prototype.getColourBorder = function() { + var colourTertiary = this.getColourTertiary(); + return { + colourBorder: colourTertiary, + colourLight: null, + colourDark: null + }; +}; + /** * Select this block. Highlight it visually. */