@@ -75,10 +75,10 @@ export function parseHexColor(text: string, start = 0): Parsed<Color> {
7575 return null ;
7676 }
7777 const end = hexColorRegEx . lastIndex ;
78- return { start, end, value : new Color ( '#' + result [ 1 ] ) } ;
78+ return { start, end, value : new Color ( '#' + result [ 1 ] ) } ;
7979}
8080
81- const cssColorRegEx = / \s * ( (?: r g b | r g b a | h s l | h s l a | h s v | h s v a ) \( [ ^ \( \) ] \) ) / gy;
81+ const cssColorRegEx = / \s * ( (?: r g b | r g b a | h s l | h s l a | h s v | h s v a ) \( [ ^ \( \) ] * \) ) / gy;
8282export function parseCssColor ( text : string , start = 0 ) : Parsed < Color > {
8383 cssColorRegEx . lastIndex = start ;
8484 const result = cssColorRegEx . exec ( text ) ;
@@ -87,11 +87,10 @@ export function parseCssColor(text: string, start = 0): Parsed<Color> {
8787 }
8888 const end = cssColorRegEx . lastIndex ;
8989 try {
90- return { start, end, value : new Color ( text ) } ;
90+ return { start, end, value : new Color ( result [ 1 ] ) } ;
9191 } catch {
9292 return null ;
9393 }
94-
9594}
9695
9796export function convertHSLToRGBColor ( hue : number , saturation : number , lightness : number ) : { r : number ; g : number ; b : number } {
@@ -132,7 +131,6 @@ export function convertHSLToRGBColor(hue: number, saturation: number, lightness:
132131 } ;
133132}
134133
135-
136134export function parseColorKeyword ( value , start : number , keyword = parseKeyword ( value , start ) ) : Parsed < Color > {
137135 const parseColor = keyword && getKnownColor ( keyword . value ) ;
138136 if ( parseColor != null ) {
0 commit comments