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

Create utility function for determining light vs. dark text when given a specific palette color. #154

Closed
NealHumphrey opened this issue Mar 6, 2017 · 2 comments
Assignees
Labels
level: expert deep knowledge of packages required priority: medium can wait until after next release type: feature a new visualizer or utility for yb
Milestone

Comments

@NealHumphrey
Copy link
Contributor

This might go in .util, or .style. Should be callable from any class, so that proper text default choice can be used.

Proposed approach:

def textColor(baseColor, textColors=("black","white")):
    # baseColor: the color of the background, in any valid color specification format
    # textColors: a tuple of (dark, light) text format. 
    if baseColor is dark:
        return textColors[0]
    elif baseColor is light:
        return textcolors[1]

This lets the user pass in specific light and dark colors to get back if they don't want white vs. black, but allows them to use it in the text function call directly as it actually returns the color (instead of just returning a boolean or something that must be interpreted).

This should especially be used in the Heatmap classifier visualizers, e.g. ClassificationReport and ConfusionMatrix

@bbengfort bbengfort added level: expert deep knowledge of packages required priority: medium can wait until after next release type: feature a new visualizer or utility for yb labels Mar 6, 2017
@bbengfort bbengfort added this to the Version 0.3.4 milestone Mar 6, 2017
@bbengfort
Copy link
Member

See #94

@NealHumphrey
Copy link
Contributor Author

Completed with PR #172

@NealHumphrey NealHumphrey removed the review PR is open label Mar 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level: expert deep knowledge of packages required priority: medium can wait until after next release type: feature a new visualizer or utility for yb
Projects
None yet
Development

No branches or pull requests

2 participants