Skip to content

Instantly share code, notes, and snippets.

Jan Mauler maulerjan

Block or report user

Report or block maulerjan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maulerjan
maulerjan / Time regex (HH:mm:ss)
Last active Aug 29, 2018
Time validating regular expressions
View Time regex (HH:mm:ss)
^(?:[0-1][0-9]|2[0-3])(?::[0-5]\d){2}$
@maulerjan
maulerjan / getBrightness.js
Created Oct 25, 2018
Get color brightness (from hexa)
View getBrightness.js
export default function getBrightness(c) {
var c = c.substring(1) // strip #
var rgb = parseInt(c, 16) // convert rrggbb to decimal
var r = (rgb >> 16) & 0xff // extract red
var g = (rgb >> 8) & 0xff // extract green
var b = (rgb >> 0) & 0xff // extract blue
var luma = (r * 299 + g * 587 + b * 114) / 1000
return luma
You can’t perform that action at this time.