Migrate Blockly.hueToHex to Blockly.utils.colour.hueToHex (#5462)

* Move hueToHex to core/utils/colour.js

* Mark Blockly.hueToHex as deprecated and pass calls through to Blockly.utils.colour.hueToHex

* Migrate core to use Blockly.utils.colour.hueToHex

* Migrate demos to use Blockly.utils.colour.hueToHex
This commit is contained in:
Aaron Dodson
2021-09-14 14:13:24 -07:00
committed by GitHub
parent d202ae0201
commit 2ba51d4d75
6 changed files with 27 additions and 14 deletions

View File

@@ -590,7 +590,8 @@ WorkspaceFactoryController.prototype.loadCategoryByName = function(name) {
}
if (!standardCategory.colour && standardCategory.hue !== undefined) {
// Calculate the hex colour based on the hue.
standardCategory.colour = Blockly.hueToHex(standardCategory.hue);
standardCategory.colour = Blockly.utils.colour.hueToHex(
standardCategory.hue);
}
// Transfers current flyout blocks to a category if it's the first category
// created.

View File

@@ -52,7 +52,7 @@ WorkspaceFactoryInit.initColourPicker_ = function(controller) {
// Convert hue numbers to RRGGBB strings.
for (var i = 0; i < colours.length; i++) {
if (colours[i] !== '') {
colours[i] = Blockly.hueToHex(colours[i]).substring(1);
colours[i] = Blockly.utils.colour.hueToHex(colours[i]).substring(1);
}
}
// Convert to 2D array.