find more rgb/hsl colors near cursor in comments and strings

This commit is contained in:
tophf 2017-11-22 21:22:36 +03:00
parent 0c3b3a1631
commit c1c61ed590

View File

@ -215,7 +215,10 @@
function parseColorAtCursor(lineText, lineTextLC = lineText.toLowerCase(), ch) { function parseColorAtCursor(lineText, lineTextLC = lineText.toLowerCase(), ch) {
const iHex = lineTextLC.lastIndexOf('#', ch); const iHex = lineTextLC.lastIndexOf('#', ch);
const iParen = lineTextLC.lastIndexOf('(', ch); const iParen = (
lineTextLC.lastIndexOf('(', ch) + 1 ||
lineTextLC.indexOf('(', ch) + 1
) - 1;
let start = Math.max(iHex, iParen); let start = Math.max(iHex, iParen);
let match, end, color, colorValue; let match, end, color, colorValue;
if (start >= 0) { if (start >= 0) {