Closed dmytro-kuz closed 2 weeks ago
Yes, the am5.Color.alternative()
function takes three parameters, e.g.:
am5.Color.alternative(am5.color(color), am5ColorLight, am5ColorDark)
My bad. I did not consider which color will be applied for white and for dark contrast. Thank you very much for your help
Question I am trying to set the color of the bullet label so it is clearly visible on the series. Depending on the shade of the series, I want to set either black or white text, similar to how the autoTextColor option works. As far as I understand, this can be achieved using the method described here: https://www.amcharts.com/docs/v5/reference/color/#alternative_method. This method returns a new Color object based on either lightAlternative or darkAlternative, depending on which one is more contrasting with the series color. Maybe I misunderstood how it works or made a mistake in the demo. But for me, in both cases (light and dark colors of the series), the white color is returned. Can you please tell me how to achieve the desired result?
Codepen: https://codepen.io/Dmytro-Kuz/pen/JjQNPPZ?editors=1010
Additional context