diff --git a/lib/coder.js b/lib/coder.js index 55bb3f9..864c4ce 100644 --- a/lib/coder.js +++ b/lib/coder.js @@ -1308,8 +1308,7 @@ var ICEcoder = { cM = ICEcoder.getcMInstance(); string = cM.getLine(cM.getCursor().line); - rx = /[a-z0-9#(),.]+/gi; - + rx = /(#[\da-f]{3,6}\b|(?:rgb|hsl)a?\([^)]*\)|[a-z]+\b)/gi; while((match = rx.exec(string)) && cM.getCursor().ch > match.index + match[0].length); @@ -1321,7 +1320,7 @@ var ICEcoder = { newBlock.style.position = "absolute"; newBlock.style.display = "block"; newBlock.style.width = newBlock.style.height = "20px"; - newBlock.style.background = match; + newBlock.style.background = match ? match[0] : ''; if (newBlock.style.backgroundColor=="") {newBlock.style.display = "none"}; top.document.getElementById('header').appendChild(newBlock); cM.addWidget(cM.getCursor(), top.document.getElementById('cssColor'), true);