File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ extension SVGHelper {
127127            let  x  =  Array ( cleanedHexString) 
128128            cleanedHexString =  " \( x [ 0 ] ) \( x [ 0 ] ) \( x [ 1 ] ) \( x [ 1 ] ) \( x [ 2 ] ) \( x [ 2 ] ) " 
129129        } 
130-         return  SVGColor ( hex:  cleanedHexString) 
130+         return  SVGColor ( hex:  cleanedHexString) . opacity ( 1.0 ) 
131131    } 
132132
133133    static  func  parseRGBANotation( colorString:  String )  ->  SVGColor  { 
@@ -142,8 +142,8 @@ extension SVGHelper {
142142        var  red  =  0.0 
143143        var  green  =  0.0 
144144        var  blue  =  0.0 
145-         var  alpha  =  1.0  // Default to fully opaque
146-         if  x. count = =  3  { 
145+         var  alpha  =  1.0  // Default to fully opaque, always from 0 to 1 in CSS 
146+         if  x. count < =  3  { 
147147            if  let  r =  Double ( x [ 0 ] ) ,  let  g =  Double ( x [ 1 ] ) ,  let  b =  Double ( x [ 2 ] )  { 
148148                blue =  b
149149                green =  g
@@ -157,11 +157,11 @@ extension SVGHelper {
157157            red *=  2.55 
158158            green *=  2.55 
159159            blue *=  2.55 
160-             if  x. count ==  4 ,   let  a  =   Double ( x [ 3 ] )  { 
161-                 alpha *=  2.55 
160+             if  x. count ==  4  { 
161+                 alpha *=  0.01 
162162            } 
163163        } 
164-         return  SVGColor ( r:  Int ( round ( red) ) ,  g:  Int ( round ( green) ) ,  b:  Int ( round ( blue) ) ) 
164+         return  SVGColor ( r:  Int ( round ( red) ) ,  g:  Int ( round ( green) ) ,  b:  Int ( round ( blue) ) ) . opacity ( round ( alpha ) ) 
165165    } 
166166
167167    static  private  func  parseIdFromUrl( _ urlString:  String )  ->  String ?   { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments