mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
Add warning message for unrecognized toolbox colour value. (PR #1881)
Fixes #1831
This commit is contained in:
committed by
Andrew n marshall
parent
c8b7b4a6a1
commit
629763e8ff
@@ -334,15 +334,15 @@ Blockly.Toolbox.prototype.syncTrees_ = function(treeIn, treeOut, pathToMedia) {
|
||||
// (eg. `%{BKY_MATH_HUE}`).
|
||||
var colour = Blockly.utils.replaceMessageReferences(
|
||||
childIn.getAttribute('colour'));
|
||||
if (goog.isString(colour)) {
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(colour)) {
|
||||
childOut.hexColour = colour;
|
||||
} else {
|
||||
childOut.hexColour = Blockly.hueToRgb(Number(colour));
|
||||
}
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(colour)) {
|
||||
childOut.hexColour = colour;
|
||||
this.hasColours_ = true;
|
||||
} else if (!isNaN(Number(colour))) {
|
||||
childOut.hexColour = Blockly.hueToRgb(Number(colour));
|
||||
this.hasColours_ = true;
|
||||
} else {
|
||||
childOut.hexColour = '';
|
||||
console.warn('Toolbox category "' + categoryName + '" has unrecognized colour attribute: ' + colour);
|
||||
}
|
||||
if (childIn.getAttribute('expanded') == 'true') {
|
||||
if (childOut.blocks.length) {
|
||||
|
||||
Reference in New Issue
Block a user