1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3515 from bonanitech/svg-icons

Make it easier to apply themes on SVG icons
This commit is contained in:
Nick O'Leary 2022-04-26 16:22:47 +01:00 committed by GitHub
commit f8d0ed7ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 137 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

View File

@ -0,0 +1 @@
<svg width="50" height="5" viewBox="0, 0, 50, 5" xmlns="http://www.w3.org/2000/svg"><path d="M0 1H50V4H0Z" fill="#CCC"/></svg>

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

View File

@ -0,0 +1 @@
<svg width="5" height="50" viewBox="0, 0, 5, 50" xmlns="http://www.w3.org/2000/svg"><path d="M1 0H4V50H1Z" fill="#CCC"/></svg>

After

Width:  |  Height:  |  Size: 127 B

View File

@ -670,7 +670,7 @@ RED.tabs = (function() {
} }
var link = $("<a/>",{href:"#"+tab.id, class:"red-ui-tab-label"}).appendTo(li); var link = $("<a/>",{href:"#"+tab.id, class:"red-ui-tab-label"}).appendTo(li);
if (tab.icon) { if (tab.icon) {
$('<img src="'+tab.icon+'" class="red-ui-tab-icon"/>').appendTo(link); $('<i>',{class:"red-ui-tab-icon", style:"mask-image: url("+tab.icon+"); -webkit-mask-image: url("+tab.icon+");"}).appendTo(link);
} else if (tab.iconClass) { } else if (tab.iconClass) {
$('<i>',{class:"red-ui-tab-icon "+tab.iconClass}).appendTo(link); $('<i>',{class:"red-ui-tab-icon "+tab.iconClass}).appendTo(link);
} }

View File

@ -669,7 +669,7 @@
if (opt.icon.indexOf("<") === 0) { if (opt.icon.indexOf("<") === 0) {
$(opt.icon).prependTo(op); $(opt.icon).prependTo(op);
} else if (opt.icon.indexOf("/") !== -1) { } else if (opt.icon.indexOf("/") !== -1) {
$('<img>',{src:mapDeprecatedIcon(opt.icon),style:"margin-right: 4px; height: 18px;"}).prependTo(op); $('<i>',{class:"red-ui-typedInput-icon", style:"mask-image: url("+opt.icon+"); -webkit-mask-image: url("+opt.icon+");"}).prependTo(op);
} else { } else {
$('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(op); $('<i>',{class:"red-ui-typedInput-icon "+opt.icon}).prependTo(op);
} }

View File

@ -142,9 +142,16 @@ body {
line-height: 14px; line-height: 14px;
vertical-align: text-top; vertical-align: text-top;
margin-top: 0px; margin-top: 0px;
background: url(images/spin.svg) no-repeat 50% 50%; -webkit-mask-image: url(images/spin.svg);
background-size: contain mask-image: url(images/spin.svg);
} -webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $spinner-color;
}
.red-ui-font-code { .red-ui-font-code {
font-family: $monospace-font; font-family: $monospace-font;

View File

@ -299,6 +299,14 @@ $group-default-label-color: #a4a4a4;
$tourGuide-border: #c56c6c; $tourGuide-border: #c56c6c;
$tourGuide-heading-color: #c56c6c; $tourGuide-heading-color: #c56c6c;
$grip-color: #ccc;
$icons-flow-color: #808080;
$spinner-color: #999;
$tab-icon-color: #dedede;
// Deprecated // Deprecated
$text-color-green: $text-color-success; $text-color-green: $text-color-success;
$info-text-code-color: $text-color-code; $info-text-code-color: $text-color-code;

View File

@ -149,11 +149,27 @@
bottom: 0px; bottom: 0px;
width: 7px; width: 7px;
left: -9px; left: -9px;
background: $primary-background url(images/grip.png) no-repeat 50% 50%; background-color: $primary-background;
cursor: col-resize; cursor: col-resize;
border-left: 1px solid $primary-border-color; border-left: 1px solid $primary-border-color;
box-shadow: -1px 0 6px $shadow; box-shadow: -1px 0 6px $shadow;
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
-webkit-mask-image: url(images/grip.svg);
mask-image: url(images/grip.svg);
-webkit-mask-size: auto;
mask-size: auto;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $grip-color;
}
&.red-ui-tray-resize-maximised { &.red-ui-tray-resize-maximised {
background: $primary-background; background: $primary-background;
cursor: default; cursor: default;

View File

@ -40,7 +40,23 @@
height: 7px; height: 7px;
box-sizing: border-box; box-sizing: border-box;
cursor: ns-resize; cursor: ns-resize;
background: $primary-background url(images/grip-horizontal.png) no-repeat 50% 50%; background-color: $primary-background;
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
-webkit-mask-image: url(images/grip-horizontal.svg);
mask-image: url(images/grip-horizontal.svg);
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $grip-color;
}
} }
@ -70,6 +86,22 @@
width: 7px; width: 7px;
display: inline-block; display: inline-block;
cursor: ew-resize; cursor: ew-resize;
background: $primary-background url(images/grip.png) no-repeat 50% 50%; background-color: $primary-background;
} }
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
-webkit-mask-image: url(images/grip.svg);
mask-image: url(images/grip.svg);
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $grip-color;
}
} }

View File

@ -47,8 +47,24 @@
bottom:10px; bottom:10px;
width: 7px; width: 7px;
// z-index: 11; // z-index: 11;
background: $primary-background url(images/grip.png) no-repeat 50% 50%; background-color: $primary-background;
cursor: col-resize; cursor: col-resize;
&:before {
content: '';
display: block;
width: 100%;
height: 100%;
-webkit-mask-image: url(images/grip.svg);
mask-image: url(images/grip.svg);
-webkit-mask-size: auto;
mask-size: auto;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $grip-color;
}
} }
.red-ui-sidebar-closed > #red-ui-sidebar { display: none; } .red-ui-sidebar-closed > #red-ui-sidebar { display: none; }

View File

@ -530,10 +530,16 @@ div.red-ui-info-table {
} }
.red-ui-icons-flow { .red-ui-icons-flow {
background-image: url('images/subflow_tab.svg'); mask-image: url(images/subflow_tab.svg);
background-repeat: no-repeat; -webkit-mask-image: url(images/subflow_tab.svg);
background-size: contain; mask-position: center;
filter: brightness(2.5); -webkit-mask-position: center;
mask-size: contain;
-webkit-mask-size: contain;
mask-repeat: no-repeat;
-webkit-mask-repeat: no-repeat;
background-color: $icons-flow-color;
// filter: brightness(2.5);
} }
.red-ui-info-toolbar { .red-ui-info-toolbar {

View File

@ -346,21 +346,28 @@
} }
img.red-ui-tab-icon {
margin-left: -8px;
margin-right: 3px;
margin-top: -2px;
opacity: 0.1;
width: 20px;
height: 20px;
vertical-align: middle;
}
i.red-ui-tab-icon { i.red-ui-tab-icon {
opacity: 0.7; opacity: 0.7;
width: 18px; width: 18px;
height: 20px; height: 20px;
&:not(.fa) {
display: inline-block;
margin-left: -8px;
margin-right: 3px;
margin-top: -2px;
opacity: 1;
width: 20px;
height: 20px;
vertical-align: middle;
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $tab-icon-color;
}
} }
.red-ui-tabs-badges { .red-ui-tabs-badges {
position: absolute; position: absolute;
top:0px; top:0px;

View File

@ -135,6 +135,13 @@
} }
.red-ui-treeList-spinner { .red-ui-treeList-spinner {
height: 32px; height: 32px;
background: url(images/spin.svg) 50% 50% no-repeat; -webkit-mask-image: url(images/spin.svg);
background-size: auto 20px; mask-image: url(images/spin.svg);
-webkit-mask-size: auto 20px;
mask-size: auto 20px;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $spinner-color;
} }

View File

@ -104,6 +104,17 @@
} }
.red-ui-typedInput-icon { .red-ui-typedInput-icon {
margin-right: 6px; margin-right: 6px;
&:not(.fa) {
-webkit-mask-size: cover;
mask-size: cover;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
background-color: $primary-text-color;
height: 14px;
width: 12px;
}
} }
} }
button.red-ui-typedInput-type-select, button.red-ui-typedInput-type-select,