Skip to content

Commit 0224e07

Browse files
committed
Round alpha values to 2DP
When converting hex colours such as #AABBCC11 to RGBA, the alpha value was being output as "0.067777776" for example which is a bit daft so round it off to 2DP to match other implementations
1 parent 363b951 commit 0224e07

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ExCSS/Values/Color.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public static Color FromHwba(float hue, float whiteness, float blackness, float
270270

271271
public int Value => _hashcode;
272272
public byte A => _alpha;
273-
public double Alpha => _alpha / 255.0;
273+
public double Alpha => Math.Round(_alpha / 255.0, 2);
274274
public byte R => _red;
275275
public byte G => _green;
276276
public byte B => _blue;

0 commit comments

Comments
 (0)