Move Blockly.hueToRgb to Blockly.utils.colour

Also adds support for ‘#f00’, ‘rgb(255, 0, 0)’ and ‘red’ for block colours, in addition to ‘#ff0000’ (and of course hue).
This commit is contained in:
Neil Fraser
2019-06-05 13:11:17 -07:00
committed by Neil Fraser
parent cdaded4296
commit ed9330cf57
4 changed files with 25 additions and 25 deletions

View File

@@ -57,8 +57,6 @@ goog.require('Blockly.inject');
goog.require('Blockly.utils');
goog.require('Blockly.Xml');
goog.require('goog.color');
// Turn off debugging when compiled.
// Unused within the Blockly library, but used in Closure.
@@ -121,16 +119,6 @@ Blockly.cache3dSupported_ = null;
*/
Blockly.theme_ = null;
/**
* Convert a hue (HSV model) into an RGB hex triplet.
* @param {number} hue Hue on a colour wheel (0-360).
* @return {string} RGB code, e.g. '#5ba65b'.
*/
Blockly.hueToRgb = function(hue) {
return goog.color.hsvToHex(hue, Blockly.HSV_SATURATION,
Blockly.HSV_VALUE * 255);
};
/**
* Returns the dimensions of the specified SVG image.
* @param {!Element} svg SVG image.