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

Add colour swatches to debug when hex colour matched

This commit is contained in:
Nick O'Leary 2017-01-16 10:29:00 +00:00
parent a03ccd7b59
commit 5b4019dd3d
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 12 additions and 2 deletions

View File

@ -106,8 +106,10 @@ RED.utils = (function() {
$('<pre class="debug-message-type-string"></pre>').text(obj).appendTo(row);
});
}
$('<span class="debug-message-type-string debug-message-object-header"></span>').html('"'+formatString(sanitize(obj))+'"').appendTo(entryObj);
e = $('<span class="debug-message-type-string debug-message-object-header"></span>').html('"'+formatString(sanitize(obj))+'"').appendTo(entryObj);
if (/^#[0-9a-f]{6}$/i.test(obj)) {
$('<span class="debug-message-type-string-swatch"></span>').css('backgroundColor',obj).appendTo(e);
}
} else if (typeof obj === 'number') {
e = $('<span class="debug-message-type-number"></span>').text(""+obj).appendTo(entryObj);

View File

@ -183,3 +183,11 @@
.debug-message-buffer-string > .debug-message-array-rows {
display: none;
}
.debug-message-type-string-swatch {
display: inline-block;
width: 1.1em;
height: 0.9em;
vertical-align: middle;
border-radius: 3px;
margin: 0 4px;
}