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
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);