diff --git a/lib/coder.js b/lib/coder.js index 864c4ce..ce23c2d 100644 --- a/lib/coder.js +++ b/lib/coder.js @@ -1304,13 +1304,13 @@ var ICEcoder = { // Show a CSS color block next to our text cursor cssColorPreview: function() { - var cM,string,rx,match,oldBlock,newBlock; + var cM, string, rx, match, oldBlock, newBlock; cM = ICEcoder.getcMInstance(); string = cM.getLine(cM.getCursor().line); - rx = /(#[\da-f]{3,6}\b|(?:rgb|hsl)a?\([^)]*\)|[a-z]+\b)/gi; + rx = /(#[\da-f]{3}(?:[\da-f]{3})?\b|\b(?:rgb|hsl)a?\([\s\d%,.-]+\)|\b[a-z]+\b)/gi; - while((match = rx.exec(string)) && cM.getCursor().ch > match.index + match[0].length); + while((match = rx.exec(string)) && cM.getCursor().ch > match.index+match[0].length); oldBlock = top.document.getElementById('content').contentWindow.document.getElementById('cssColor'); if (oldBlock) {oldBlock.parentNode.removeChild(oldBlock)};