Skip to content

Commit

Permalink
Fix category colors not supporting 8-character hex codes
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jan 9, 2024
1 parent 958df3f commit 80adc23
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,12 @@ Blockly.Toolbox.Category.prototype.setColour = function(node) {
var colour = node.getAttribute('colour');
var secondaryColour = node.getAttribute('secondaryColour');
if (goog.isString(colour)) {
if (colour.match(/^#[0-9a-fA-F]{6}$/)) {
if (colour.match(/^#[0-9a-fA-F]{6,8}$/)) {
this.colour_ = colour;
} else {
this.colour_ = Blockly.hueToRgb(colour);
}
if (secondaryColour.match(/^#[0-9a-fA-F]{6}$/)) {
if (secondaryColour.match(/^#[0-9a-fA-F]{6,8}$/)) {
this.secondaryColour_ = secondaryColour;
} else {
this.secondaryColour_ = Blockly.hueToRgb(secondaryColour);
Expand Down

0 comments on commit 80adc23

Please sign in to comment.