From acb5d895f871ffff8e6196e5e9ddcf13f2042ebc Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Wed, 1 Apr 2020 15:29:34 -0700 Subject: [PATCH] Move flyout label css into the renderer (#3780) * Move flyout label css into the renderer and add theme options --- core/flyout_button.js | 4 ---- core/renderers/common/constants.js | 16 +++++++++++++--- core/renderers/zelos/constants.js | 16 +++++++++++++--- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/core/flyout_button.js b/core/flyout_button.js index 51173c917..f4cead8af 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -294,9 +294,5 @@ Blockly.Css.register([ '.blocklyFlyoutLabelBackground {', 'opacity: 0;', '}', - - '.blocklyFlyoutLabelText {', - 'fill: #000;', - '}' /* eslint-enable indent */ ]); diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index 6708c09f4..8a5b19cff 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -1165,13 +1165,18 @@ Blockly.blockRendering.ConstantProvider.prototype.injectCSS_ = function( Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(selector) { return [ /* eslint-disable indent */ - // Fields. - selector + ' .blocklyText {', - 'fill: #fff;', + // Text. + selector + ' .blocklyText, ', + selector + ' .blocklyFlyoutLabelText {', 'font-family: ' + this.FIELD_TEXT_FONTFAMILY + ';', 'font-size: ' + this.FIELD_TEXT_FONTSIZE + 'pt;', 'font-weight: ' + this.FIELD_TEXT_FONTWEIGHT + ';', '}', + + // Fields. + selector + ' .blocklyText {', + 'fill: #fff;', + '}', selector + ' .blocklyNonEditableText>rect,', selector + ' .blocklyEditableText>rect {', 'fill: ' + this.FIELD_BORDER_RECT_COLOUR + ';', @@ -1183,6 +1188,11 @@ Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(selector) { 'fill: #000;', '}', + // Flyout labels. + selector + ' .blocklyFlyoutLabelText {', + 'fill: #000;', + '}', + // Bubbles. selector + ' .blocklyText.blocklyBubbleText {', 'fill: #000;', diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index cac9a0545..57ebdca11 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -904,13 +904,18 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg, Blockly.zelos.ConstantProvider.prototype.getCSS_ = function(selector) { return [ /* eslint-disable indent */ - // Fields. - selector + ' .blocklyText {', - 'fill: #fff;', + // Text. + selector + ' .blocklyText, ', + selector + ' .blocklyFlyoutLabelText {', 'font-family: ' + this.FIELD_TEXT_FONTFAMILY + ';', 'font-size: ' + this.FIELD_TEXT_FONTSIZE + 'pt;', 'font-weight: ' + this.FIELD_TEXT_FONTWEIGHT + ';', '}', + + // Fields. + selector + ' .blocklyText {', + 'fill: #fff;', + '}', selector + ' .blocklyNonEditableText>rect:not(.blocklyDropdownRect),', selector + ' .blocklyEditableText>rect:not(.blocklyDropdownRect) {', 'fill: ' + this.FIELD_BORDER_RECT_COLOUR + ';', @@ -921,6 +926,11 @@ Blockly.zelos.ConstantProvider.prototype.getCSS_ = function(selector) { selector + ' .blocklyEditableText>g>text {', 'fill: #575E75;', '}', + + // Flyout labels. + selector + ' .blocklyFlyoutLabelText {', + 'fill: #575E75;', + '}', // Bubbles. selector + ' .blocklyText.blocklyBubbleText {',