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

Merge pull request #3801 from kazuhitoyokoi/master-subflowcolor

Support color reset to the default in subflow and group
This commit is contained in:
Nick O'Leary 2022-08-04 13:02:04 +01:00 committed by GitHub
commit 4ae914f729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -76,6 +76,9 @@ RED.editor.colorPicker = RED.colorPicker = (function() {
var focusTarget = colorInput; var focusTarget = colorInput;
colorInput.on("change", function (e) { colorInput.on("change", function (e) {
var color = colorInput.val(); var color = colorInput.val();
if (options.defaultValue && !color.match(/^([a-z]+|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3})$/)) {
color = options.defaultValue;
}
colorHiddenInput.val(color).trigger('change'); colorHiddenInput.val(color).trigger('change');
refreshDisplay(color); refreshDisplay(color);
}); });

View File

@ -235,6 +235,7 @@
RED.editor.colorPicker.create({ RED.editor.colorPicker.create({
id: "red-ui-editor-node-color", id: "red-ui-editor-node-color",
value: color, value: color,
defaultValue: "#DDAA99",
palette: recommendedColors, palette: recommendedColors,
sortPalette: function (a, b) {return a.l - b.l;} sortPalette: function (a, b) {return a.l - b.l;}
}).appendTo(colorRow); }).appendTo(colorRow);

View File

@ -101,6 +101,7 @@ RED.group = (function() {
RED.editor.colorPicker.create({ RED.editor.colorPicker.create({
id:"node-input-style-stroke", id:"node-input-style-stroke",
value: style.stroke || defaultGroupStyle.stroke || "#a4a4a4", value: style.stroke || defaultGroupStyle.stroke || "#a4a4a4",
defaultValue: "#a4a4a4",
palette: colorPalette, palette: colorPalette,
cellPerRow: colorCount, cellPerRow: colorCount,
cellWidth: 16, cellWidth: 16,
@ -112,6 +113,7 @@ RED.group = (function() {
RED.editor.colorPicker.create({ RED.editor.colorPicker.create({
id:"node-input-style-fill", id:"node-input-style-fill",
value: style.fill || defaultGroupStyle.fill ||"none", value: style.fill || defaultGroupStyle.fill ||"none",
defaultValue: "none",
palette: colorPalette, palette: colorPalette,
cellPerRow: colorCount, cellPerRow: colorCount,
cellWidth: 16, cellWidth: 16,
@ -129,6 +131,7 @@ RED.group = (function() {
RED.editor.colorPicker.create({ RED.editor.colorPicker.create({
id:"node-input-style-color", id:"node-input-style-color",
value: style.color || defaultGroupStyle.color ||"#a4a4a4", value: style.color || defaultGroupStyle.color ||"#a4a4a4",
defaultValue: "#a4a4a4",
palette: colorPalette, palette: colorPalette,
cellPerRow: colorCount, cellPerRow: colorCount,
cellWidth: 16, cellWidth: 16,