fix: hex colors to allow alpha channel#1274
Merged
nickofthyme merged 3 commits intoelastic:masterfrom Jul 29, 2021
Merged
Conversation
markov00
approved these changes
Jul 29, 2021
Collaborator
Author
|
Oh wow, I didn't even notice that |
github-actions bot
pushed a commit
that referenced
this pull request
Aug 6, 2021
# [33.2.0](v33.1.0...v33.2.0) (2021-08-06) ### Bug Fixes * heatmap snap domain to interval ([#1253](#1253)) ([b439182](b439182)), closes [#1165](#1165) * hex colors to allow alpha channel ([#1274](#1274)) ([03b4f42](03b4f42)) ### Features * **bullet:** the tooltip shows up around the drawn part of the chart only ([#1278](#1278)) ([a96cbb4](a96cbb4)) * **legend:** multiline labels with maxLines option ([#1285](#1285)) ([e0eb096](e0eb096))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Color logic now correctly handles alpha channel values for 8-bit hex values as was/is possible with
rgba,hslaformats.Details
The
getColormethod now leverageschroma.jsfor robust color validation and parsing to feed tod3-colorutils.Below is a list of possible edge cases to supply as
inputstogetColorand the respective returnoutputsundefined{"r":255,"g":0,"b":0,"opacity":1}""{"r":255,"g":0,"b":0,"opacity":1}"bad"{"r":187,"g":170,"b":221,"opacity":1}"#00000000"{"r":0,"g":0,"b":0,"opacity":0}"#000000"{"r":0,"g":0,"b":0,"opacity":1}"#6092c000"{"r":96,"g":146,"b":192,"opacity":0}"#6092c06b"{"r":96,"g":146,"b":192,"opacity":0.42}"blue"{"r":0,"g":0,"b":255,"opacity":1}"hsl(20, 100%, 40%)"{"r":204,"g":68,"b":0,"opacity":1}"hsla(20, 100%, 40%, 0.5)"{"r":204,"g":68,"b":0,"opacity":0.5}"hsla(20, 100%, 40%, 0)"{"r":204,"g":68,"b":0,"opacity":0}"rgb(0,128,128)"{"r":0,"g":128,"b":128,"opacity":1}"rgba(0,128,128,0.5)"{"r":0,"g":128,"b":128,"opacity":0.5}"rgba(0,128,128,0)"{"r":0,"g":128,"b":128,"opacity":0}Issues
fix #1263
Checklist
packages/charts/src/index.ts(and stories only import from../srcexcept for test data & storybook)