Skip to content

Instantly share code, notes, and snippets.

View tabatkins's full-sized avatar

Tab Atkins Jr. tabatkins

View GitHub Profile
<?php
/**
*
* ----------------------------------------------
* HTML to JSON
* ----------------------------------------------
*
* [Currently used in Wordpress to output HTML into a Google Maps InfoWindow correctly]
*
@tabatkins
tabatkins / RGBAtoHSLA.js
Created March 19, 2012 18:18 — forked from jonathantneal/RGB2HSL.js
RGBA to HSLA
function RGBAtoHSLA(r, g, b, a) {
var
min = Math.min(r, g, b),
max = Math.max(r, g, b),
diff = max - min,
hsla = [0, 0, (min + max) / 2, a];
if (diff != 0) {
hsla[1] = hsla[2] < 0.5 ? diff / (max + min) : diff / (2 - max - min);