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

Inverting brightness only. #49

Open
davidbjames opened this issue Jun 11, 2019 · 0 comments
Open

Inverting brightness only. #49

davidbjames opened this issue Jun 11, 2019 · 0 comments

Comments

@davidbjames
Copy link

It would be helpful to invert only the brightness while retaining the hue and saturation of a color. Is this possible? There is currently DynamicColor.invert. Would it be useful to add a DynamicColor.invertBrightness ?

I tried with the following code, and I get inconsistent results (for example, light-medium orange becomes almost black instead of dark orange). Mostly I'm finding the resulting colors are darker then I would expect.

let hue = hueComponent
let saturation = saturationComponent
let brightness = 1 - brightnessComponent
let alpha = alphaComponent
return DynamicColor(hue:hue, saturation:saturation, brightness:brightness, alpha:alpha)
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

1 participant