✅ Hex color converter breaks on 3-digit and 4-digit values
I made this nifty lil' converter from hexadecimal strings to
System.Drawing.Color
s. It works perfectly for 6-digit and 8-digit values, but tests fail for 3-digit and 4-digit ones.
1 Reply
Ah, derp, nevermind
The test was faulty
I was trying to assert that
4F0
produces Color.FromArgb(0x4, 0xF, 0x0)
where it should've been Color.FromArgb(0x44, 0xFF, 0x00)
since each digit in a 3-digit code needs to be duplicated
Same for 4-digit codes