public static String expandShorthandHex ( String color ) { validateHex ( color ) ; if ( color . length ( ) < 6 ) { StringBuilder expandColor = new StringBuilder ( ) ; int startIndex = 0 ; if ( color . startsWith ( "#" ) ) { expandColor . append ( "#" ) ; startIndex ++ ; } for ( ; startIndex < color . length ( ) ; startIndex ++ ) { String expand = expandShorthandHexSingle ( color . substring ( startIndex , startIndex + 1 ) ) ; expandColor . append ( expand ) ; } color = expandColor . toString ( ) ; } return color ; }
Expand the hex if it is in shorthand