Skip to content
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

Ensure text contrast #181

Open
broadpeter opened this issue Dec 8, 2023 · 1 comment
Open

Ensure text contrast #181

broadpeter opened this issue Dec 8, 2023 · 1 comment

Comments

@broadpeter
Copy link
Collaborator

All templates with directly labelling either on bars or beside data points should have options to ensure text contrast either

  • ability to separately set text in config
  • or text that automatically adjusts
    For example on bars, black or white text based on calculation of darkness of data using some code like this:
var color = .. function giving color of the bar ..
text.style("fill", function(d) { return d3.hsl(color(d)).l > 0.5 ? "#000" : "#fff" })
@henryjameslau
Copy link
Member

Could use chroma.js to calculate contrast

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

No branches or pull requests

2 participants