Skip to content

Added support for hex code colors - #276

Open
fredbradley wants to merge 2 commits into
SimpleSoftwareIO:developfrom
fredbradley:develop
Open

fredbradley wants to merge 2 commits into
SimpleSoftwareIO:developfrom
fredbradley:develop

Conversation

@fredbradley

Copy link
Copy Markdown

Add support for hex code colors rather than RGB.

Usage:

(new Generator)->color('#fff')->backgroundColor('#000');

Usage for Eye color is slightly different due to complexity:

(new Generator)->eyeColorFromHex(0, '#fff', '#000');

Test suite: I had trouble validating the "getAlpha()" methods on the test suite, but I couldn't work out why as the code should be the same. But Hex codes don't have alpha so it wouldn't make a difference to end result, but if someone can solve the test suite (currently commented out)

@Jamalofski

Copy link
Copy Markdown

Thanks for this PR. Hex colors shipped in jamalofski/simple-qrcode 4.4.0, a maintained fork of this package, with you as co-author. They are new methods, so that color() keeps its signature for code that extends the generator: colorFromHex(), backgroundColorFromHex(), eyeColorFromHex() and gradientFromHex(), with #rgb, #rgba, #rrggbb or #rrggbbaa. Background in #332.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants