File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
test/com/inet/lib/less/samples/general Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -214,9 +214,21 @@ private void eval( CssFormatter formatter ) {
214214 }
215215 unit = "" ;
216216 long rgb ;
217+ long alpha = ALPHA_1 ;
217218 if ( str .startsWith ( "#" ) ) {
218219 str = str .substring ( 1 );
219220 switch ( str .length () ) {
221+ case 4 :
222+ {
223+ char ch = str .charAt ( 3 );
224+ int digit = Character .digit ( ch , 16 );
225+ if ( digit < 0 ) {
226+ type = STRING ;
227+ return ;
228+ }
229+ alpha = digit * 0x1111 << 48 ;
230+ }
231+ //$FALL-THROUGH$
220232 case 3 :
221233 rgb = 0 ;
222234 for ( int i = 0 ; i < 3 ; i ++ ) {
@@ -231,6 +243,24 @@ private void eval( CssFormatter formatter ) {
231243 rgb *= 0x100 ;
232244 }
233245 break ;
246+ case 8 :
247+ {
248+ char ch = str .charAt ( 6 );
249+ int digit = Character .digit ( ch , 16 );
250+ if ( digit < 0 ) {
251+ type = STRING ;
252+ return ;
253+ }
254+ rgb = digit * 16 ;
255+ ch = str .charAt ( 7 );
256+ digit = Character .digit ( ch , 16 );
257+ if ( digit < 0 ) {
258+ type = STRING ;
259+ return ;
260+ }
261+ alpha = (rgb + digit ) * 0x101 << 48 ;
262+ }
263+ //$FALL-THROUGH$
234264 case 6 :
235265 rgb = 0 ;
236266 for ( int i = 0 ; i < 6 ; i ++ ) {
@@ -298,7 +328,7 @@ private void eval( CssFormatter formatter ) {
298328 }
299329 }
300330 }
301- value = Double .longBitsToDouble ( ALPHA_1 | rgb );
331+ value = Double .longBitsToDouble ( alpha | rgb );
302332 type = COLOR ;
303333 } catch ( NumberFormatException e ) {
304334 type = STRING ;
Original file line number Diff line number Diff line change 1+ colors {
2+ a : # 000A ;
3+ b : # 001122AA ;
4+ }
Original file line number Diff line number Diff line change 1+ colors {
2+ a : #000A ;
3+ b : #001122AA ;
4+ }
You can’t perform that action at this time.
0 commit comments