Move utilities into own directory.

TODO: There are more functions which may be migrated into dom and string.
This commit is contained in:
Neil Fraser
2019-06-06 17:30:34 -07:00
committed by Neil Fraser
parent cf91b82bb0
commit d1a29739d8
67 changed files with 1168 additions and 946 deletions

View File

@@ -600,6 +600,16 @@ Blockly.isNumber = function(str) {
return /^\s*-?\d+(\.\d+)?\s*$/.test(str);
};
/**
* 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.hueToHex = function(hue) {
return Blockly.utils.colour.hsvToHex(hue, Blockly.HSV_SATURATION,
Blockly.HSV_VALUE * 255);
};
/**
* Checks old colour constants are not overwritten by the host application.
* If a constant is overwritten, it prints a console warning directing the