-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Area Charts : Fill color isn't applied when color is rgb() #4742
Comments
Not a bug, but a missing feature. You can convert the rgb to hex with a function like this function rgb2hex(rgb) {
rgb = rgb.match(
/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i
)
return rgb && rgb.length === 4
? '#' +
('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) +
('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) +
('0' + parseInt(rgb[3], 10).toString(16)).slice(-2)
: ''
} |
Or use rgba() color format: colors: ['rgba(236, 22, 26, 0.1)'], |
Mh, thanks for your answers. I do not understand in which scope it's not a bug. Actually, there is a reproducible way to have a not working fill opacity attribute. The minimal fix should be to update the documentation, adding that opacity works only with an hexadecimal color. A more valuable fix should be to integrate opacity in an rgba() call and use it when color is rgb and opacity is given. |
Description
When using a rgb() color, the filling in the graph does not take into account the opacity.
Steps to Reproduce
See that the graph is full opaque.
2. Replace the color by the exact same hexadecimal color :
See that this time, the graph is not opaque.
Expected Behavior
The graph should not be opaque.
Actual Behavior
Screenshots
With rgb :
With hex :
Reproduction Link
With rgb : https://codepen.io/slokilla/pen/bGXpBge
With hexa : https://codepen.io/slokilla/pen/LYwNbbM
The text was updated successfully, but these errors were encountered: