Light or Dark

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

Hindi dapat direktang i-install ang script na ito. Ito ay isang library para sa iba pang mga script na isasama sa meta directive. // @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:

May akda
escctrl
Bersyon
1.1
Nilikha
2024-04-07
Na update
2026-05-17
Laki
994 Bytes
Lisensya
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);