Skip to content

Commit

Permalink
feat: rename color properties for input text and text
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy O'Neill committed Feb 15, 2023
1 parent 5258e78 commit 46e92fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions core/colours.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ Blockly.Colours = {
"secondary": "#FF4D6A",
"tertiary": "#FF3355"
},
"text": "#575E75",
"blockText": "#FFFFFF",
"text": "#FFFFFF",
"workspace": "#F9F9F9",
"toolboxHover": "#4C97FF",
"toolboxSelected": "#e9eef2",
Expand All @@ -93,6 +92,7 @@ Blockly.Colours = {
"scrollbar": "#CECDCE",
"scrollbarHover": '#CECDCE',
"textField": "#FFFFFF",
"textFieldText": "#575E75",
"insertionMarker": "#000000",
"insertionMarkerOpacity": 0.2,
"dragShadowOpacity": 0.3,
Expand Down
33 changes: 17 additions & 16 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ Blockly.Css.inject = function(hasCss, pathToMedia) {
text = text.replace(/<<<PATH>>>/g, Blockly.Css.mediaPath_);
// Dynamically replace colours in the CSS text, in case they have
// been set at run-time injection.
for (var colourProperty in Blockly.Colours) {
if (Blockly.Colours.hasOwnProperty(colourProperty)) {
// Replace all
text = text.replace(
new RegExp('\\$colour\\_' + colourProperty, 'g'),
Blockly.Colours[colourProperty]
);
}
// Process longer colour properties first to handle common prefixes.
var compareByLength = function(a, b) { return b.length - a.length; };
var colourProperties = Object.keys(Blockly.Colours).sort(compareByLength);
for (var i = 0, colourProperty; colourProperty = colourProperties[i]; i++) {
// Replace all
text = text.replace(
new RegExp('\\$colour\\_' + colourProperty, 'g'),
Blockly.Colours[colourProperty]
);
}

// Inject CSS tag at start of head.
Expand Down Expand Up @@ -459,7 +460,7 @@ Blockly.Css.CONTENT = [
'}',

'.blocklyText {',
'fill: $colour_blockText;',
'fill: $colour_text;',
'font-family: "Helvetica Neue", Helvetica, sans-serif;',
'font-size: 12pt;',
'font-weight: 500;',
Expand All @@ -474,19 +475,19 @@ Blockly.Css.CONTENT = [
'}',
'.blocklyNonEditableText>text,',
'.blocklyEditableText>text {',
'fill: $colour_text;',
'fill: $colour_textFieldText;',
'}',

'.blocklyEditableText>.blocklyEditableLabel {',
'fill: #fff;',
'}',

'.blocklyDropdownText {',
'fill: #fff !important;',
'fill: $colour_text !important;',
'}',

'.blocklyBubbleText {',
'fill: $colour_text;',
'fill: $colour_textFieldText;',
'}',
'.blocklyFlyout {',
'position: absolute;',
Expand All @@ -502,7 +503,7 @@ Blockly.Css.CONTENT = [
'}',

'.blocklyFlyoutButton .blocklyText {',
'fill: $colour_text;',
'fill: $colour_textFieldText;',
'}',

'.blocklyFlyoutButtonShadow {',
Expand Down Expand Up @@ -720,7 +721,7 @@ Blockly.Css.CONTENT = [
'box-sizing: border-box;',
'width: 100%;',
'text-align: center;',
'color: $colour_text;',
'color: $colour_textFieldText;',
'font-weight: 500;',
'}',

Expand Down Expand Up @@ -1014,7 +1015,7 @@ Blockly.Css.CONTENT = [
'.scratchNotePickerKeyLabel {',
'font-family: "Helvetica Neue", Helvetica, sans-serif;',
'font-size: 0.75rem;',
'fill: $colour_text;',
'fill: $colour_textFieldText;',
'pointer-events: none;',
'}',

Expand Down Expand Up @@ -1095,7 +1096,7 @@ Blockly.Css.CONTENT = [
'}',

'.blocklyDropDownDiv .goog-menuitem {',
'color: #fff;',
'color: $colour_text;',
'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
'font-weight: bold;',
'list-style: none;',
Expand Down

0 comments on commit 46e92fb

Please # to comment.