Light or Dark

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

Цей скрипт не слід встановлювати безпосередньо. Це - бібліотека для інших скриптів для включення в мета директиву // @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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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:

Автор
escctrl
Версія
1.1
Створено
07.04.2024
Оновлено
17.05.2026
Size
994 байти
Ліцензія
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);