Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
update color extraction to allow parentheses (#423)
Brad Cornes <bradlc41@gmail.com>
3 years ago
1 changed files, 3 additions(+), 3 deletions(-)
M packages/tailwindcss-language-service/src/util/color.ts -> packages/tailwindcss-language-service/src/util/color.ts
diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts
index 3e4cdfab5a860a6426cc5735fda129c63625b5db..4c4ca2bc77bd908013dcf97decfb99c0340e8e25 100644
--- a/packages/tailwindcss-language-service/src/util/color.ts
+++ b/packages/tailwindcss-language-service/src/util/color.ts
@@ -42,9 +42,9 @@ }
 
 // https://github.com/khalilgharbaoui/coloregex
 const colorRegex = new RegExp(
-  `(?:^|\\s|,)(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?(\\s*[,/]\\s*|\\s+)+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys(
+  `(?:^|\\s|\\(|,)(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?(\\s*[,/]\\s*|\\s+)+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys(
     namedColors
-  ).join('|')})(?:$|\\s|,)`,
+  ).join('|')})(?:$|\\s|\\)|,)`,
   'gi'
 )
 
@@ -57,7 +57,7 @@       .match(colorRegex)
       ?.map((color) =>
         color
           .trim()
-          .replace(/^,|,$/g, '')
+          .replace(/^[,(]|[,)]$/g, '')
           .replace(/var\([^)]+\)/, '1')
       )
       .map((color) => getKeywordColor(color) ?? culori.parse(color))