CSS - hsl or rgb(a) colors

前端 未结 4 2111
臣服心动
臣服心动 2020-12-07 17:09

I am about to start a new project and I want its CSS to be both consistent and performant. I was wondering which color units I should use. Medium and Trello have different a

4条回答
  •  庸人自扰
    2020-12-07 17:32

    In my opinion:

    HSL(A):
    

    Pro: HSL is convenient when making things lighter or darker, is faster to write, allow you to modify luminosity and saturation without modifying the color itself.

    Cons: HSL could be not supported in older browser (like IE < 9).

    RGB(A):
    

    Pros: RGBA is well-known and supported even in older browser.

    Cons: When making things lighter or darker you need to rewrite the color.

提交回复
热议问题