diff --git a/src/lsp/util/color.ts b/src/lsp/util/color.ts index 31d56ec33a369f671737f625a3d61c8960ca7d4b..95d54170555430e9334be51c46aee88876164365 100644 --- a/src/lsp/util/color.ts +++ b/src/lsp/util/color.ts @@ -48,50 +48,21 @@ propsToCheck.map((prop) => ensureArray(item[prop]).map(createColor)) ) // check that all of the values are valid colors - if (colors.some((color) => color !== 'transparent' && !color.isValid)) { + if (colors.some((color) => !color.isValid)) { return null } - // check that all of the values are the same color, ignoring alpha - const colorStrings = dedupe( -import { TinyColor } from '@ctrl/tinycolor' 'caret-color', + 'color', -import { TinyColor } from '@ctrl/tinycolor' 'color', -import { ensureArray, dedupe, flatten } from '../../util/array' -import { ensureArray, dedupe, flatten } from '../../util/array' + 'color', const dlv = require('dlv') - ) - ) - if (colorStrings.length !== 1) { return null } - if (colorStrings[0] === 'transparent') { - return { - documentation: 'rgba(0, 0, 0, 0.01)', - } -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 { - import { State } from './state' -import removeMeta from './removeMeta' - .toRgbString(), - } - } - - return null - export function getColorFromValue(value: unknown): string { @@ -106,9 +77,9 @@ } return null } -function createColor(str: string): TinyColor | 'transparent' { +function createColor(str: string): TinyColor { if (str === 'transparent') { - return 'transparent' + return new TinyColor({ r: 0, g: 0, b: 0, a: 0.01 }) } // matches: rgba(, , , var(--bg-opacity))