From a7c0a25deeed6e588a1a58ad670d1a925c12ed7d Mon Sep 17 00:00:00 2001 From: chengcq Date: Tue, 30 Nov 2021 12:05:50 +0800 Subject: [PATCH] fix: treat css variable as color --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 75c4b61..90044c1 100644 --- a/index.js +++ b/index.js @@ -52,7 +52,7 @@ cs.get.rgb = function (string) { var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i; var rgba = /^rgba?\(\s*([+-]?\d+)\s*,?\s*([+-]?\d+)\s*,?\s*([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/; var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/; - var keyword = /(\w+)/; + var keyword = /^(\w+)$/; var rgb = [0, 0, 0, 1]; var match;