From e20a7ef3c2c8b5a07cebe2f3f697d259c608d777 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Fri, 1 Mar 2019 12:38:37 -0800 Subject: [PATCH] Use constants for dropdown div colours in the colour field --- core/field_colour.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/core/field_colour.js b/core/field_colour.js index 62fc44a73..54bfc532e 100644 --- a/core/field_colour.js +++ b/core/field_colour.js @@ -99,6 +99,22 @@ Blockly.FieldColour.prototype.titles_ = null; */ Blockly.FieldColour.prototype.columns_ = 0; +/** + * Border colour for the dropdown div showing the colour picker. Must be a CSS + * string. + * @type {string} + * @private + */ +Blockly.FieldColour.prototype.DROPDOWN_BORDER_COLOUR = 'silver'; + +/** + * Background colour for the dropdown div showing the colour picker. Must be a + * CSS string. + * @type {string} + * @private + */ +Blockly.FieldColour.prototype.DROPDOWN_BACKGROUND_COLOUR = 'white'; + /** * Install this field on a block. */ @@ -267,9 +283,8 @@ Blockly.FieldColour.prototype.showEditor_ = function() { var picker = this.createWidget_(); Blockly.DropDownDiv.getContentDiv().appendChild(picker); - // Dropdown div accepts CSS colours. - // But maybe this should be done with a class instead? - Blockly.DropDownDiv.setColour('white', 'silver'); + Blockly.DropDownDiv.setColour( + this.DROPDOWN_BACKGROUND_COLOUR, this.DROPDOWN_BORDER_COLOUR); Blockly.DropDownDiv.showPositionedByField(this);