Permalink
Browse files

Merge pull request #1536 from vincentbriglia/develop

Add ability to overwrite default block colours
  • Loading branch information...
kchadha committed Jul 24, 2018
2 parents 2c3aa5e + ad32d42 commit 27716b6d59ea68b31be8f52aad22ccc993cfc3ae
Showing with 16 additions and 1 deletion.
  1. +3 −0 .gitignore
  2. +13 −1 core/options.js
View
@@ -13,6 +13,9 @@ common.pyc
*.komodoproject
/nbproject/private/
# Editor
.vscode
/accessible/*
/dist
/msg/js/*
View
@@ -127,7 +127,19 @@ Blockly.Options = function(options) {
Blockly.Colours.hasOwnProperty(colourProperty)) {
// If a property is in both colours option and Blockly.Colours,
// set the Blockly.Colours value to the override.
Blockly.Colours[colourProperty] = colours[colourProperty];
// Override Blockly category color object properties with those
// provided.
var colourPropertyValue = colours[colourProperty];
if (goog.isObject(colourPropertyValue)) {
for (var colourSequence in colourPropertyValue) {
if (colourPropertyValue.hasOwnProperty(colourSequence) &&
Blockly.Colours[colourProperty].hasOwnProperty(colourSequence)) {
Blockly.Colours[colourProperty][colourSequence] = colourPropertyValue[colourSequence];
}
}
} else {
Blockly.Colours[colourProperty] = colourPropertyValue;
}
}
}
}

0 comments on commit 27716b6

Please sign in to comment.