File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 99} from 'vscode-languageserver'
1010const dlv = require ( 'dlv' )
1111import removeMeta from '../util/removeMeta'
12- import { getColor , getColorFromString } from '../util/color'
12+ import { getColor , getColorFromValue } from '../util/color'
1313import { isHtmlContext } from '../util/html'
1414import { isCssContext } from '../util/css'
1515import { findLast , findJsxStrings , arrFindLast } from '../util/find'
@@ -269,7 +269,7 @@ function provideCssHelperCompletions(
269269 return {
270270 isIncomplete : false ,
271271 items : Object . keys ( obj ) . map ( ( item , index ) => {
272- let color = getColorFromString ( obj [ item ] )
272+ let color = getColorFromValue ( obj [ item ] )
273273 const replaceDot : boolean =
274274 item . indexOf ( '.' ) !== - 1 && separator && separator . endsWith ( '.' )
275275 const insertClosingBrace : boolean =
Original file line number Diff line number Diff line change @@ -61,11 +61,12 @@ export function getColor(
6161 return { documentation : colorStrings [ 0 ] }
6262}
6363
64- export function getColorFromString ( str : string ) : string {
65- if ( str === 'transparent' ) {
64+ export function getColorFromValue ( value : unknown ) : string {
65+ if ( typeof value !== 'string' ) return null
66+ if ( value === 'transparent' ) {
6667 return 'rgba(0, 0, 0, 0.01)'
6768 }
68- const color = new TinyColor ( str )
69+ const color = new TinyColor ( value )
6970 if ( color . isValid ) {
7071 return color . toRgbString ( )
7172 }
You can’t perform that action at this time.
0 commit comments