Skip to content

Ensure the entry background contrasts with the current color #3

Description

@tabatkins

The entry box uses partially-transparent black as its background color, which means that it disappears completely if your entered color is very dark.

Instead, you should detect when the current color is 'dark' and switch to using partially-transparent white. A simple way to do so is to use this formula for lightness:

.2126 * Math.pow(r,2.2) + .7152 * Math.pow(g,2.2) + .0722 * Math.pow(b,2.2)

(This assumes that r, g, and b are in the range [0,1].)

If the lightness is > .5, use black background. If < .5, use white background.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions