diff --git a/.eslintignore b/.eslintignore
index bcf2a79fb..792c074e6 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -4,6 +4,7 @@ gulpfile.js
/msg/*
/core/utils/global.js
/tests/blocks/*
+/tests/themes/*
/tests/compile/*
/tests/jsunit/*
/tests/generators/*
diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js
index be6e8a50e..4451ee040 100644
--- a/core/renderers/common/constants.js
+++ b/core/renderers/common/constants.js
@@ -42,6 +42,13 @@ Blockly.blockRendering.ConstantProvider = function() {
*/
this.DYNAMICALLY_SET_STRING_ = '';
+ /**
+ * A placeholder value for boolean constants that are dynamically set.
+ * @type {boolean}
+ * @protected
+ */
+ this.DYNAMICALLY_SET_BOOLEAN_ = false;
+
/**
* The size of an empty spacer.
* @type {number}
@@ -195,7 +202,7 @@ Blockly.blockRendering.ConstantProvider = function() {
* connections. Can be overridden by 'hat' property on Theme.BlockStyle.
* @type {boolean}
*/
- this.ADD_START_HATS = false;
+ this.ADD_START_HATS = this.DYNAMICALLY_SET_BOOLEAN_;
/**
* Height of the top hat.
@@ -605,6 +612,8 @@ Blockly.blockRendering.ConstantProvider.prototype.setDynamicProperties_ =
function(theme) {
/* eslint-disable indent */
this.setFontConstants_(theme);
+
+ this.ADD_START_HATS = theme.startHats != null ? theme.startHats : false;
}; /* eslint-enable indent */
/**
diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js
index cdd09750f..78583de92 100644
--- a/core/renderers/zelos/constants.js
+++ b/core/renderers/zelos/constants.js
@@ -407,8 +407,10 @@ Blockly.zelos.ConstantProvider.prototype.init = function() {
/**
* @override
*/
-Blockly.zelos.ConstantProvider.prototype.setTheme = function(theme) {
- Blockly.zelos.ConstantProvider.superClass_.setTheme.call(this, theme);
+Blockly.zelos.ConstantProvider.prototype.setDynamicProperties_ = function(
+ theme) {
+ Blockly.zelos.ConstantProvider.superClass_.setDynamicProperties_.call(this,
+ theme);
this.SELECTED_GLOW_COLOUR =
theme.getComponentStyle('selectedGlowColour') ||
diff --git a/core/theme.js b/core/theme.js
index cacf1d646..a9d7d5751 100644
--- a/core/theme.js
+++ b/core/theme.js
@@ -61,8 +61,17 @@ Blockly.Theme = function(name, blockStyles, categoryStyles,
/**
* The font style.
* @type {?Blockly.Theme.FontStyle}
+ * @package
*/
this.fontStyle = null;
+
+ /**
+ * Whether or not to add a 'hat' on top of all blocks with no previous or
+ * output connections.
+ * @type {?boolean}
+ * @package
+ */
+ this.startHats = null;
};
/**
@@ -121,6 +130,15 @@ Blockly.Theme.prototype.setFontStyle = function(fontStyle) {
this.fontStyle = fontStyle;
};
+/**
+ * Configure a theme's start hats.
+ * @param {boolean} startHats True if the theme enables start hats, false
+ * otherwise.
+*/
+Blockly.Theme.prototype.setStartHats = function(startHats) {
+ this.startHats = startHats;
+};
+
/**
* Gets the style for a given Blockly UI component. If the style value is a
* string, we attempt to find the value of any named references.
diff --git a/tests/playground.html b/tests/playground.html
index 409a8b5a5..9f3d5cfd9 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -65,6 +65,7 @@
+