funkhaus / fuxt

A complete Headless WordPress tech stack built on Nuxt.
219 stars 28 forks source link

utils - getBrightness.js #73

Closed Sveb closed 1 year ago

Sveb commented 1 year ago

Utility Created: getBrightness.js

Notes:

Check the brightness of the color and return a value from 0 to 255, the latter being the brightest

drewbaker commented 1 year ago

What was this used for?

Because I think this should be renamed to isDark() and it's true or false. Not sure how useful a number between 0 or 255 is?

Sveb commented 1 year ago

It's being used on strada. Specificaly on this page. https://xd.adobe.com/view/9062fafe-681c-4f19-be15-067799289434-c531/screen/f0cf529a-cb7a-422d-9c7a-c7e29e0d6bb0/specs/ , https://xd.adobe.com/view/9062fafe-681c-4f19-be15-067799289434-c531/screen/2c96f895-3f9f-4991-af68-71a354b86ae3/specs/ (notice the top of the two pages). So checks the background-solors brigthness and returns the value. Agreed, it 's better to rename it to a different name and make it return a corresponding true or false.