Skip to content

Conversation

nathanallen
Copy link
Contributor

@nathanallen nathanallen commented Jun 3, 2017

Added tests, and updated regex to match alpha channel hex colors with 4 or 8 values.

The regex checks for 3 or 4 values first, then tries 4+2 or 4+2+2 values.
/^#([a-f0-9]{3,4}|[a-f0-9]{4}(?:[a-f0-9]{2}){1,2})\b$/i

But perhaps the longhand would be more readable (perhaps ordered from most common to least):
/^#([a-f0-9]{6}|[a-f0-9]{3}|[a-f0-9]{8}|[a-f0-9]{4})\b$/i

fixes #10

@coveralls
Copy link

coveralls commented Jun 3, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 7a9406d on nathanallen:alpha-channel-support into 338c1bb on regexhq:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 7a9406d on nathanallen:alpha-channel-support into 338c1bb on regexhq:master.

@tunnckoCore tunnckoCore merged commit c044704 into regexhq:master Jun 3, 2017
@tunnckoCore
Copy link
Member

Sweeeet! 🎉 🐙

I'll publish in a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants