Skip to content

Commit 454a163

Browse files
authored
Use Node-RED CSS vars in nodes config tab (#795)
1 parent 0478329 commit 454a163

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

nodes/ui_base.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
position: absolute;
167167
right: 36px;
168168
border-radius: 3px !important;
169-
border: solid 1px #ccc;
169+
border: solid 1px var(--red-ui-form-input-border-color, #ccc);
170170
-webkit-appearance: none;
171171
font-size: smaller;
172172
text-align: center;
@@ -230,13 +230,13 @@
230230
<link rel="stylesheet" href="./ui_base/css/gridstack-extra.min.css">
231231
<style>
232232
.grid-stack {
233-
background-color: #f8f8f8;
234-
border: solid 2px #C0C0C0;
233+
background-color: var(--red-ui-primary-background, #f8f8f8);
234+
border: solid 2px var(--red-ui-tertiary-border-color, #C0C0C0);
235235
margin: auto;
236236
min-height: 42px;
237237
display: table-cell;
238-
background-image: linear-gradient(#C0C0C0 1px, transparent 0),
239-
linear-gradient(90deg, #C0C0C0 1px, transparent 0);
238+
background-image: linear-gradient(var(--red-ui-tertiary-border-color, #C0C0C0) 1px, transparent 0),
239+
linear-gradient(90deg, var(--red-ui-tertiary-border-color, #C0C0C0) 1px, transparent 0);
240240
background-size: 40px 43px;
241241
}
242242
.grid-stack>.grid-stack-item>.grid-stack-item-content {
@@ -1321,7 +1321,7 @@
13211321
.css("width","80%")
13221322
.css("display","inline-block")
13231323
.appendTo(divDateFormat);
1324-
$('<div>').html("<a href='https://momentjs.com/docs/#/displaying/format/' target='_new'><i class='fa fa-info-circle' style='color:grey;'></i></a>")
1324+
$('<div>').html("<a href='https://momentjs.com/docs/#/displaying/format/' target='_new'><i class='fa fa-info-circle' style='color:var(--red-ui-secondary-text-color, grey);'></i></a>")
13251325
.css("display","inline-block")
13261326
.css("margin-right","6px")
13271327
.css("float","right")
@@ -3049,17 +3049,17 @@
30493049
var c_width = has_height ? '15%' : '6%';
30503050
var container = $('<div>').css({
30513051
position: 'absolute',
3052-
background: 'white',
3052+
background: 'var(--red-ui-secondary-background, white)',
30533053
padding: '10px 10px 10px 10px',
3054-
border: '1px solid grey',
3054+
border: '1px solid var(--red-ui-primary-border-color, grey)',
30553055
zIndex: '20',
30563056
borderRadius: "4px",
30573057
display:"none",
30583058
width: c_width
30593059
}).appendTo(document.body);
30603060
var box0 = $("<div>").css({
30613061
fontSize: '13px',
3062-
color: '#aaa',
3062+
color: 'var(--red-ui-tertiary-text-color, #aaa)',
30633063
float: 'left',
30643064
paddingTop: '1px'
30653065
}).appendTo(container);
@@ -3162,9 +3162,9 @@
31623162
var pos = $(this).offset();
31633163
var container = $('<div>').css({
31643164
position: 'absolute',
3165-
background: 'white',
3165+
background: 'var(--red-ui-secondary-background, white)',
31663166
padding: '5px 10px 10px 10px',
3167-
border: '1px solid grey',
3167+
border: '1px solid var(--red-ui-primary-border-color, grey)',
31683168
zIndex: '20',
31693169
borderRadius: "4px",
31703170
display:"none"
@@ -3182,7 +3182,7 @@
31823182

31833183
var label = $("<div>").css({
31843184
fontSize: '13px',
3185-
color: '#aaa',
3185+
color: 'var(--red-ui-tertiary-text-color, #aaa)',
31863186
float: 'left',
31873187
paddingTop: '1px'
31883188
}).appendTo(container).text((width === 0 && height === 0)?auto_text:(width+(that.options.hasOwnProperty('height')?" x "+height:"")));
@@ -3231,9 +3231,9 @@
32313231
});
32323232
}
32333233

3234-
var cellBorder = "1px dashed lightGray";
3234+
var cellBorder = "1px dashed var(--red-ui-secondary-border-color, lightGray)";
32353235
var cellBorderExisting = "1px solid gray";
3236-
var cellBorderHighlight = "1px dashed black";
3236+
var cellBorderHighlight = "1px dashed var(--red-ui-primary-border-color, black)";
32373237
var rows = [];
32383238
function addRow(i) {
32393239
var row = $('<div>').css({padding:0,margin:0,height:"25px","box-sizing":"border-box"}).appendTo(container);
@@ -3253,7 +3253,7 @@
32533253
borderBottom: (i===(height-1)&&j<width)?cellBorderExisting:cellBorder,
32543254
boxSizing: "border-box",
32553255
cursor:"pointer",
3256-
background: (j<maxWidth)?"#fff":"#eee"
3256+
background: (j<maxWidth)?"var(--red-ui-secondary-background, #fff)" : "var(--red-ui-node-background-placeholder, #eee)"
32573257
}).appendTo(row);
32583258
cells[i].push(cell);
32593259
if (j===0) {
@@ -3278,7 +3278,7 @@
32783278
for (var y = 0; y<maxHeight; y++) {
32793279
for (var x = 0; x<maxWidth; x++) {
32803280
cells[y][x].css({
3281-
background: (y<=h && x<=w)?'#ddd':'#fff',
3281+
background: (y<=h && x<=w)?'var(--red-ui-secondary-background-selected, #ddd)' : 'var(--red-ui-secondary-background, #fff)',
32823282
borderLeft: (x===0&&y<=h)?cellBorderHighlight:(x===0)?((y<=height-1)?cellBorderExisting:cellBorder):'',
32833283
borderTop: (y===0&&x<=w)?cellBorderHighlight:(y===0)?((x<=width-1)?cellBorderExisting:cellBorder):'',
32843284
borderRight: (x===w&&y<=h)?cellBorderHighlight:((x===width-1&&y<=height-1)?cellBorderExisting:cellBorder),

nodes/ui_dropdown.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
else { $("#valWarning").show(); }
5252

5353
function generateOption(i, option) {
54-
var container = $('<li/>',{style:"background: #fff; margin:0; padding:8px 0px 0px; border-bottom: 1px solid #ccc;"});
54+
var container = $('<li/>',{style:"background: var(--red-ui-secondary-background, #fff); margin:0; padding:8px 0px 0px; border-bottom: 1px solid var(--red-ui-form-input-border-color, #ccc);"});
5555
var row = $('<div/>').appendTo(container);
5656
var row2 = $('<div/>',{style:"padding-top:5px; padding-left:175px;"}).appendTo(container);
5757
var row3 = $('<div/>',{style:"padding-top:5px; padding-left:120px;"}).appendTo(container);
5858

59-
$('<i style="color:#eee; cursor:move; margin-left:3px;" class="node-input-option-handle fa fa-bars"></i>').appendTo(row);
59+
$('<i style="color: var(--red-ui-form-text-color, #eee); cursor:move; margin-left:3px;" class="node-input-option-handle fa fa-bars"></i>').appendTo(row);
6060

6161
var valueField = $('<input/>',{class:"node-input-option-value",type:"text",style:"margin-left:7px; width:calc(50% - 32px);", placeholder: 'Value',value:option.value}).appendTo(row).typedInput({default:option.type||'str',types:['str','num','bool']});
6262
var labelField = $('<input/>',{class:"node-input-option-label",type:"text",style:"margin-left:7px; width:calc(50% - 32px);", placeholder: 'Label', value:option.label}).appendTo(row);
@@ -66,7 +66,7 @@
6666
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
6767

6868
deleteButton.click(function() {
69-
container.css({"background":"#fee"});
69+
container.css({"background":"var(--red-ui-secondary-background-inactive, #fee)"});
7070
container.fadeOut(300, function() {
7171
$(this).remove();
7272
});
@@ -147,8 +147,8 @@
147147
</div>
148148
<div class="form-row node-input-option-container-row" style="margin-bottom: 0px;width: 100%">
149149
<label for="node-input-width" style="vertical-align:top"><i class="fa fa-list-alt"></i> Options</label>
150-
<div id="node-input-option-container-div" style="box-sizing:border-box; border-radius:5px; height:257px; padding:5px; border:1px solid #ccc; overflow-y:scroll; display:inline-block; width:calc(70% + 15px);">
151-
<span id="valWarning" style="color:#910000"><b>All Values must be unique.</b></span>
150+
<div id="node-input-option-container-div" style="box-sizing:border-box; border-radius:5px; height:257px; padding:5px; border:1px solid var(--red-ui-form-input-border-color, #ccc); overflow-y:scroll; display:inline-block; width:calc(70% + 15px);">
151+
<span id="valWarning" style="color: var(--red-ui-text-color-error, #910000)"><b>All Values must be unique.</b></span>
152152
<ol id="node-input-option-container" style="list-style-type:none; margin:0;"></ol>
153153
</div>
154154
</div>

nodes/ui_form.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
}
6262

6363
function generateOption(i, option) {
64-
var container = $('<li/>',{style:"margin:0; padding:8px 0px 0px; border-bottom:1px solid #ccc;"});
64+
var container = $('<li/>',{style:"margin:0; padding:8px 0px 0px; border-bottom:1px solid var(--red-ui-form-input-border-color, #ccc);"});
6565
var row = $('<div/>').appendTo(container);
6666
var row2 = $('<div/>',{style:"padding-top:5px; padding-left:175px;"}).appendTo(container);
6767
var row3 = $('<div/>',{style:"padding-top:5px; padding-left:120px;"}).appendTo(container);
@@ -135,7 +135,7 @@
135135

136136
deleteButton.click(function() {
137137
container.find(".node-input-option-value").removeAttr('required')
138-
container.css({"background":"#fee"});
138+
container.css({"background":"var(--red-ui-secondary-background-inactive, #fee)"});
139139
container.fadeOut(300, function() {
140140
$(this).remove();
141141
});
@@ -214,7 +214,7 @@
214214
left: 0;
215215
right: 0;
216216
bottom: 0;
217-
background-color: #ccc;
217+
background-color: var(--red-ui-tertiary-border-color, #ccc);
218218
-webkit-transition: .4s;
219219
transition: .4s;
220220
}
@@ -226,7 +226,7 @@
226226
width: 15px;
227227
left: 2px;
228228
bottom: 2px;
229-
background-color: white;
229+
background-color: var(--red-ui-secondary-background, white);
230230
-webkit-transition: .4s;
231231
transition: .4s;
232232
}
@@ -271,8 +271,8 @@
271271
</div>
272272
<div class="form-row node-input-option-container-row" style="margin-bottom:0px; width:100%; min-width:520px">
273273
<label style="vertical-align:top;"><i class="fa fa-list-alt"></i> <span data-i18n="ui_form.label.formElements"></label>
274-
<div style="display:inline-block; width:78%; border:1px solid #ccc; border-radius:5px; box-sizing:border-box;">
275-
<div class="red-ui-tray-header" style="width:100%; display: inline-block; padding-top:10px; padding-bottom:10px; border-top:0px solid; border-radius:5px 5px 0 0; border-bottom:1px solid #ccc;">
274+
<div style="display:inline-block; width:78%; border:1px solid var(--red-ui-form-input-border-color, #ccc); border-radius:5px; box-sizing:border-box;">
275+
<div class="red-ui-tray-header" style="width:100%; display: inline-block; padding-top:10px; padding-bottom:10px; border-top:0px solid; border-radius:5px 5px 0 0; border-bottom:1px solid var(--red-ui-form-input-border-color, #ccc);">
276276
<div style="width:94%; display:inline-block; margin-left:27px">
277277
<div style="width:20%; text-align:center; float:left;" data-i18n="ui_form.label.label"></span></div>
278278
<div style="width:20%; text-align:center; float:left; margin-left:9px" data-i18n="node-red:common.label.name"></div>

nodes/ui_text.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@
122122
width: 90px;
123123
height: 60px;
124124
border-radius:3px;
125-
border:1px solid #bbb;
125+
border:1px solid var(--red-ui-form-input-border-color, #bbb);
126126
cursor:pointer;
127127
color: #666;
128128
margin-right: 10px;
129129
margin-bottom: 10px;
130130
}
131131
.nr-db-text-layout.selected, .nr-db-text-layout:hover {
132-
border-color: #333;
133-
color: #333;
132+
border-color: var(--red-ui-form-input-border-selected-color, #333);
133+
color: var(--red-ui-secondary-text-color-selected, #333);
134134
}
135135
.nr-db-text-layout span {
136136
position: absolute;
@@ -156,11 +156,11 @@
156156
width: 10px;
157157
height: 10px;
158158
border-radius: 10px;
159-
border: 1px solid #bbb;
159+
border: 1px solid var(--red-ui-primary-border-color, #bbb);
160160
position: absolute;
161161
right: -5px;
162162
top: -5px;
163-
background: #fff;
163+
background: var(--red-ui-secondary-background, #fff);
164164
}
165165
.nr-db-text-layout.selected .nr-db-text-layout-checkbox {
166166
display:inline-block;

0 commit comments

Comments
 (0)