Light or Dark

library to determine if the color parameter is a 'light' or a 'dark' color

Tätä skriptiä ei tulisi asentaa suoraan. Se on kirjasto muita skriptejä varten sisällytettäväksi metadirektiivillä // @require https://update.greasyfork.org/scripts/491888/1827644/Light%20or%20Dark.js.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

Tekijä
escctrl
Versio
1.1
Luotu
7.4.2024
Päivitetty
17.5.2026
Size
994 tavua
Lisenssi
GNU GPL-3.0-only

✍️ How to use it

Call the function lightOrDark() with the color you want to test.
Returns string "light" or "dark" accordingly.

For example:

const bgLightOrDark = lightOrDark(window.getComputedStyle(document.body).backgroundColor);