File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 9
9
} from 'vscode-languageserver'
10
10
const dlv = require ( 'dlv' )
11
11
import removeMeta from '../util/removeMeta'
12
- import { getColor , getColorFromString } from '../util/color'
12
+ import { getColor , getColorFromValue } from '../util/color'
13
13
import { isHtmlContext } from '../util/html'
14
14
import { isCssContext } from '../util/css'
15
15
import { findLast , findJsxStrings , arrFindLast } from '../util/find'
@@ -269,7 +269,7 @@ function provideCssHelperCompletions(
269
269
return {
270
270
isIncomplete : false ,
271
271
items : Object . keys ( obj ) . map ( ( item , index ) => {
272
- let color = getColorFromString ( obj [ item ] )
272
+ let color = getColorFromValue ( obj [ item ] )
273
273
const replaceDot : boolean =
274
274
item . indexOf ( '.' ) !== - 1 && separator && separator . endsWith ( '.' )
275
275
const insertClosingBrace : boolean =
Original file line number Diff line number Diff line change @@ -61,11 +61,12 @@ export function getColor(
61
61
return { documentation : colorStrings [ 0 ] }
62
62
}
63
63
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' ) {
66
67
return 'rgba(0, 0, 0, 0.01)'
67
68
}
68
- const color = new TinyColor ( str )
69
+ const color = new TinyColor ( value )
69
70
if ( color . isValid ) {
70
71
return color . toRgbString ( )
71
72
}
You can’t perform that action at this time.
0 commit comments