| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I created a couple of PRs (#78 and #81) in a dependency used by color that will add some new features for parsing color strings that would bring it closer to parity with TinyColor. The maintainer recently merged one of these and will (hopefully) be merging the other soon. Once he publishes a new release, I'll be able to use it in plotly.js. |
Sorry, something went wrong.
|
@camdecoster Looks good overall, but lightened/darkened colors seem much less distinct after this change, is there any way to adjust that? Maybe increase the degree of lightening/darkening?
(codepen) |
Sorry, something went wrong.
| }; | ||
|
|
||
| color.rgb = function(cstr) { return color.tinyRGB(tinycolor(cstr)); }; | ||
| const rgb = (cstr) => { |
There was a problem hiding this comment.
Can you add a comment explaining that this is for returning a string which doesn't contain alpha? (Or whatever is the purpose of this function, I'm assuming it's that because of the comment in the old file.)
Sorry, something went wrong.
There was a problem hiding this comment.
More generally if you could add a few docstrings for the most-commonly-used functions in that file it would be a big improvement
Sorry, something went wrong.
There was a problem hiding this comment.
I'll add descriptions for all the functions in here.
Sorry, something went wrong.
| "- hex (e.g. '#d3d3d3', '#d3d3d3aa')", | ||
| "- rgb (e.g. 'rgb(255, 0, 0)', 'rgb(255 0 0)')", | ||
| "- rgba (e.g. 'rgba(255, 0, 0, 0.5)', 'rgba(255 0 0 / 0.5)')", | ||
| "- hsl (e.g. 'hsl(0, 100%, 50%)')", | ||
| "- hsla (e.g. 'hsla(0, 100%, 50%, 0.5)')", | ||
| "- hwb (e.g. 'hwb(0, 0%, 0%)')", |
There was a problem hiding this comment.
Weirdly, I can't find this info in the docs anywhere, although I could be missing it. We should make sure the supported color formats are documented with the next release.
Sorry, something went wrong.
There was a problem hiding this comment.
I agree. I'm prepping a migration guide for v4 that should include some of this info, but a follow up should be to update the docs for v4.
Sorry, something went wrong.
|
|
||
| for(i = 0; i < colorList.length; i++) { | ||
| colors.push(tinycolor(colorList[i]).lighten(20).toHexString()); | ||
| colors.push(Color.color(colorList[i]).lighten(0.2).hex()); |
There was a problem hiding this comment.
Re: my comment about lightened/darkened colors being too similar, I assume you could just increase this value here to fix.
Sorry, something went wrong.
There was a problem hiding this comment.
I reworked the lighten/darken code to better match what tinycolor did.
Sorry, something went wrong.
There was a problem hiding this comment.
My only concern is the lighten/darken changes, everything else looks good
Sorry, something went wrong.
|
@camdecoster Nice, with your edits, the lightened/darkened colors look identical to master.
|
Sorry, something went wrong.
There was a problem hiding this comment.
🌈
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
Switch color processing library from TinyColor to color.
Related to #7523.
Changes
Testing
Screenshots
Color.contrast, Color.brighten, and Color.addOpacity produce slightly different RGB output. Here are some example plots that can be used to see the difference between tinycolor and color when pasted into Plotly devtools:
Auto-contrast text on a heatmap
Auto inside-text color on default colorway
Pie with extended colorway (lighten/darken)
Notes