File tree Expand file tree Collapse file tree
src/vs/workbench/services/themes/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -788,29 +788,27 @@ function normalizeColor(color: string | Color | undefined | null): string | unde
788788 if ( typeof color !== 'string' ) {
789789 color = Color . Format . CSS . formatHexA ( color , true ) ;
790790 }
791- if ( color . charCodeAt ( 0 ) !== CharCode . Hash ) {
791+ const len = color . length ;
792+ if ( color . charCodeAt ( 0 ) !== CharCode . Hash || ( len !== 4 && len !== 5 && len !== 7 && len !== 9 ) ) {
792793 return undefined ;
793794 }
794795 let result = [ CharCode . Hash ] ;
795- const len = color . length ;
796+
796797 for ( let i = 1 ; i < len ; i ++ ) {
797798 const upper = hexUpper ( color . charCodeAt ( i ) ) ;
798799 if ( ! upper ) {
799800 return undefined ;
800801 }
801802 result . push ( upper ) ;
802- if ( len === 3 || len === 4 ) {
803+ if ( len === 4 || len === 5 ) {
803804 result . push ( upper ) ;
804805 }
805806 }
806807
807808 if ( result . length === 9 && result [ 7 ] === CharCode . F && result [ 8 ] === CharCode . F ) {
808809 result . length = 7 ;
809810 }
810- if ( result . length === 7 ) {
811- return String . fromCharCode ( ...result ) ;
812- }
813- return undefined ;
811+ return String . fromCharCode ( ...result ) ;
814812}
815813
816814function hexUpper ( charCode : CharCode ) : number {
You can’t perform that action at this time.
0 commit comments