Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 3, 2020 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/bc56755458b62ed31a3f5eef0db62c37 to your computer and use it in GitHub Desktop.
Save parzibyte/bc56755458b62ed31a3f5eef0db62c37 to your computer and use it in GitHub Desktop.
<?php
/*
https://parzibyte.me/blog
*/
function hexadecimalARgb($hexadecimal)
{
list($r, $g, $b) = sscanf($hexadecimal, "#%02x%02x%02x");
return [$r, $g, $b];
}
$colorHexadecimal = "#8BC34A";
$rgb = hexadecimalARgb($colorHexadecimal);
# Ahora tenemos a R en $rgb[0], G en $rgb[1] y B en $rgb[2]
print_r($rgb);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment