Skip to content

Instantly share code, notes, and snippets.

View fedetibaldo's full-sized avatar
🌱
Living, I guess

Federico Tibaldo fedetibaldo

🌱
Living, I guess
View GitHub Profile
@fedetibaldo
fedetibaldo / hexhsl.php
Created January 27, 2018 22:18 — forked from bedeabza/hexhsl.php
PHP Hex to HSL and HSL to Hex conversion
<?php
function hexToHsl($hex) {
$hex = array($hex[0].$hex[1], $hex[2].$hex[3], $hex[4].$hex[5]);
$rgb = array_map(function($part) {
return hexdec($part) / 255;
}, $hex);
$max = max($rgb);
$min = min($rgb);