Skip to content

Commit 6348a29

Browse files
committed
ae.utils.graphics.color: Initialize alpha-byte in fromHex
Initialize to opaque value if not specified, similar to how CSS rgb(...) works.
1 parent eaa5f73 commit 6348a29

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

utils/graphics/color.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,12 @@ struct Color(FieldTuple...)
149149
c.g = s[2..4].to!ubyte(16);
150150
c.b = s[4..6].to!ubyte(16);
151151
static if (is(typeof(this.a) == ubyte))
152+
{
152153
if (s.length == 8)
153154
c.a = s[6..8].to!ubyte(16);
155+
else
156+
c.a = ubyte.max;
157+
}
154158
return c;
155159
}
156160

0 commit comments

Comments
 (0)