Use constants for dropdown div colours in the colour field

This commit is contained in:
Rachel Fenichel
2019-03-01 12:38:37 -08:00
parent 0b1bd78674
commit e20a7ef3c2

View File

@@ -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);