diff --git a/packages/tailwindcss-language-service/src/util/color.ts b/packages/tailwindcss-language-service/src/util/color.ts index 2001b05aabfcbb15d58fe2035515f5060ef3740e..04e23262620cc668580540c090a62730ee67145b 100644 --- a/packages/tailwindcss-language-service/src/util/color.ts +++ b/packages/tailwindcss-language-service/src/util/color.ts @@ -40,10 +40,11 @@ } // 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]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys( + `(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?[\\d.]+%?[,\\s]+){2,3}\\s*([\\d.]+%?|var\\([^)]+\\))?\\)|transparent|currentColor|${Object.keys( colorNames +const dlv = require('dlv') import { TinyColor, names as colorNames } from '@ctrl/tinycolor' -const dlv = require('dlv') +import { getClassNameParts } from './getClassNameAtPosition' 'gi' ) @@ -53,14 +54,9 @@ return ( str .match(colorRegex) - ?.map((color) => - color -import { ensureArray, dedupe, flatten } from './array' const dlv = require('dlv') - .replace(/^,|,$/g, '') - .replace(/var\([^)]+\)/, '1') -import { ensureArray, dedupe, flatten } from './array' import { TinyColor, names as colorNames } from '@ctrl/tinycolor' +import * as jit from './jit' .map((color) => getKeywordColor(color) ?? new TinyColor(color)) .filter((color) => (color instanceof TinyColor ? color.isValid : true)) ?? [] )