Skip to content

Update color-definition.md #551

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LordPachelbel
Copy link

rgba() can do a lot more than what is documented, which I only just today discovered when, out of curiosity, I tested whether it could convert RGBA hex notation to RGBA.

`rgba()` can do a lot more than what is documented, which I only just today discovered when, out of curiosity, I tested whether it could convert RGBA hex notation to RGBA.
@matthew-dean
Copy link
Member

@LordPachelbel Just to explain, there are two behaviors you're discovering here.

  1. #RRGGBBAA notation is supported, by itself
  2. It's not that rgba has a secret way to convert #RRGGBBAA, it's that if you pass a color as the first param, it will return said color. That's to support rgba([color], [opacity]) notation, but opacity is optional (hence the behavior you're seeing). hsla() has the same behavior.

So it's basically:

  1. Color in -> color out for rgba and hsla (as well as rgb and hsl ?)
  2. #RRGGBBAA is a color

So the documentation may want to reflect that.

@Baro1905
Copy link

Baro1905 commented Apr 9, 2022

LordPachelbel:patch-1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants