Light or Dark

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

Dette script bør ikke installeres direkte. Det er et bibliotek, som andre scripts kan inkludere med metadirektivet // @require https://update.greatest.deepsurf.us/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:

Skaber
escctrl
Version
1.1
Oprettet
07.04.2024
Opdateret
17.05.2026
Size
994 bytes
Licens
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);