Skip to content

Instantly share code, notes, and snippets.

View sebrax's full-sized avatar

Sulivan Braga sebrax

View GitHub Profile
@sebrax
sebrax / JavaScript - Determine if Hex Color is Light or Dark.js
Created November 22, 2023 15:43 — forked from krabs-github/JavaScript - Determine if Hex Color is Light or Dark.js
[JavaScript - Determine if Hex Color is Light or Dark] JavaScript - Determine if Hex Color is Light or Dark #JavaScript
function lightOrDark(color) {
// Check the format of the color, HEX or RGB?
if (color.match(/^rgb/)) {
// If HEX --> store the red, green, blue values in separate variables
color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
r = color[1];
g = color[2];
@sebrax
sebrax / .gitignore
Created April 20, 2021 21:16 — forked from iffy/.gitignore
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot