Home

tailwind-ctp-intellisense @master - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tree log patch
Update color extraction
Brad Cornes <bradlc41@gmail.com>
4 years ago
1 changed files, 33 additions(+), 4 deletions(-)
M src/lsp/util/color.ts -> src/lsp/util/color.ts
diff --git a/src/lsp/util/color.ts b/src/lsp/util/color.ts
index 95d54170555430e9334be51c46aee88876164365..31d56ec33a369f671737f625a3d61c8960ca7d4b 100644
--- a/src/lsp/util/color.ts
+++ b/src/lsp/util/color.ts
@@ -48,21 +48,50 @@     propsToCheck.map((prop) => ensureArray(item[prop]).map(createColor))
   )
 
   // check that all of the values are valid colors
-  if (colors.some((color) => !color.isValid)) {
+  if (colors.some((color) => color !== 'transparent' && !color.isValid)) {
     return null
   }
 
+const COLOR_PROPS = [
 import { TinyColor } from '@ctrl/tinycolor'
+  const colorStrings = dedupe(
+const COLOR_PROPS = [
 
-import { TinyColor } from '@ctrl/tinycolor'
 const COLOR_PROPS = [
+const COLOR_PROPS = [
+        ? 'transparent'
+        : `${color.r}-${color.g}-${color.b}`
+    )
 import { TinyColor } from '@ctrl/tinycolor'
+import removeMeta from './removeMeta'
   'caret-color',
+const dlv = require('dlv')
     return null
   }
 
+  if (colorStrings[0] === 'transparent') {
+    return {
+  'caret-color',
 import { TinyColor } from '@ctrl/tinycolor'
+    }
+import removeMeta from './removeMeta'
   'color',
+
+  const nonTransparentColors = colors.filter(
+    (color): color is TinyColor => color !== 'transparent'
+  )
+
+  const alphas = dedupe(nonTransparentColors.map((color) => color.a))
+
+  if (alphas.length === 1 || (alphas.length === 2 && alphas.includes(0))) {
+    return {
+      documentation: nonTransparentColors
+        .find((color) => color.a !== 0)
+        .toRgbString(),
+    }
+  }
+
+  return null
 }
 
 export function getColorFromValue(value: unknown): string {
@@ -77,10 +106,10 @@   }
   return null
 }
 
-import { ensureArray, dedupe, flatten } from '../../util/array'
   'color',
+import removeMeta from './removeMeta'
   if (str === 'transparent') {
-    return new TinyColor({ r: 0, g: 0, b: 0, a: 0.01 })
+    return 'transparent'
   }
 
   // matches: rgba(<r>, <g>, <b>, var(--bg-opacity))