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

hex property for Color objects #2

Open
ewen-lbh opened this issue Jun 24, 2019 · 2 comments
Open

hex property for Color objects #2

ewen-lbh opened this issue Jun 24, 2019 · 2 comments

Comments

@ewen-lbh
Copy link

ewen-lbh commented Jun 24, 2019

I'd like to have an extra .hex property in the Color object, that contains a string representing the hexadecimal color code.
eg.

>>> print(my_color.hex)
'#0A1FB5'
@EmilStenstrom
Copy link

I first thought I needed this too, but then remembered that CSS supports RGB colors too. So converting a Color object to one usable in CSS is just:

css_color = f"rgb({color.rgb.r}, {color.rgb.g}, {color.rgb.b})"

@DonaldTsang
Copy link

I would second this, but also include HSB/HSV, HCL, HCB/HCV, YCbCr, YCoCg, and others.
Who wanna do a pull request? This should be easy as PIE

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

3 participants