',{class:"red-ui-search-result-node"}).appendTo(div);
- var colour = def.color;
+ var colour = RED.utils.getNodeColor(object.type,def);
var icon_url = RED.utils.getNodeIcon(def);
nodeDiv.css('backgroundColor',colour);
diff --git a/editor/js/ui/utils.js b/editor/js/ui/utils.js
index 81da08dd3..13d27d5bd 100644
--- a/editor/js/ui/utils.js
+++ b/editor/js/ui/utils.js
@@ -794,6 +794,40 @@ RED.utils = (function() {
return RED.text.bidi.enforceTextDirectionWithUCC(l);
}
+ var nodeColorCache = {};
+ function getNodeColor(type, def) {
+ var result = def.color;
+ var paletteTheme = RED.settings.theme('palette.theme') || [];
+ if (paletteTheme.length > 0) {
+ if (!nodeColorCache.hasOwnProperty(type)) {
+ var l = paletteTheme.length;
+ for (var i=0;i
').appendTo(container);
if (contain) {
@@ -852,6 +886,7 @@ RED.utils = (function() {
getDefaultNodeIcon: getDefaultNodeIcon,
getNodeIcon: getNodeIcon,
getNodeLabel: getNodeLabel,
+ getNodeColor: getNodeColor,
addSpinnerOverlay: addSpinnerOverlay,
decodeObject: decodeObject,
parseContextKey: parseContextKey
diff --git a/editor/js/ui/view-navigator.js b/editor/js/ui/view-navigator.js
index da1908982..2a67c4da5 100644
--- a/editor/js/ui/view-navigator.js
+++ b/editor/js/ui/view-navigator.js
@@ -46,7 +46,7 @@
.attr("y",function(d) { return (d.y-d.h/2)/nav_scale })
.attr("width",function(d) { return Math.max(9,d.w/nav_scale) })
.attr("height",function(d) { return Math.max(3,d.h/nav_scale) })
- .attr("fill",function(d) { return d._def.color;})
+ .attr("fill",function(d) { return RED.utils.getNodeColor(d.type,d._def);})
});
}
function onScroll() {
diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js
index 4559c5ec4..4688c15cd 100644
--- a/editor/js/ui/view.js
+++ b/editor/js/ui/view.js
@@ -2038,7 +2038,7 @@ RED.view = (function() {
.attr("ry",4)
.attr("width",16)
.attr("height",node_height-12)
- .attr("fill",function(d) { return d._def.color;})
+ .attr("fill",function(d) { return RED.utils.getNodeColor(d.type,d._def); /*d._def.color;*/})
.attr("cursor","pointer")
.on("mousedown",function(d) {if (!lasso && isButtonEnabled(d)) {focusView();d3.select(this).attr("fill-opacity",0.2);d3.event.preventDefault(); d3.event.stopPropagation();}})
.on("mouseup",function(d) {if (!lasso && isButtonEnabled(d)) { d3.select(this).attr("fill-opacity",0.4);d3.event.preventDefault();d3.event.stopPropagation();}})
@@ -2059,7 +2059,7 @@ RED.view = (function() {
.classed("node_unknown",function(d) { return d.type == "unknown"; })
.attr("rx", 5)
.attr("ry", 5)
- .attr("fill",function(d) { return d._def.color;})
+ .attr("fill",function(d) { return RED.utils.getNodeColor(d.type,d._def); /*d._def.color;*/})
.on("mouseup",nodeMouseUp)
.on("mousedown",nodeMouseDown)
.on("touchstart",function(d) {