Evaluate whether a HEX value is dark or light

前端 未结 4 829
难免孤独
难免孤独 2020-12-28 20:03

The user of the ASP.NET web app I\'m building can select colors for use on some of the elements (e.g. buttons/titles) to facilitate some degree of personalisation.

4条回答
  •  有刺的猬
    2020-12-28 20:41

    Convert to HSL and look at the Luminance value. This will tell you how bright it is.

    Here is a javascript function for doing the conversion.

提交回复
热议问题