This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hex2rgb( $col ) { | |
if ( $col[0] == '#' ) { | |
$col = substr( $col, 1 ); | |
} | |
if (strlen( $col ) == 6) { | |
list( $r, $g, $b ) = array( $col[0] . $col[1], $col[2] . $col[3], $col[4] . $col[5] ); | |
} elseif (strlen( $col ) == 3) { | |
list( $r, $g, $b ) = array( $col[0] . $col[0], $col[1] . $col[1], $col[2] . $col[2] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Some_Class_To_Parse_Colors_From_Images | |
{ | |
function logo() | |
{ | |
$src = 'public/dummy/logo2.png'; | |
$im = imagecreatefrompng(ROOT . $src); | |
$w0 = imagesx($im); | |
$h0 = imagesy($im); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery Favicon plugin | |
* http://hellowebapps.com/products/jquery-favicon/ | |
* | |
* Copyright (c) 2010 Volodymyr Iatsyshyn ([email protected]) | |
* Dual licensed under the MIT and GPL licenses: | |
* http://www.opensource.org/licenses/mit-license.php | |
* http://www.gnu.org/licenses/gpl.html | |
* | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getColor() | |
{ | |
$tod = localtime(); | |
$now = $tod[1] + ($tod[2] * 60.0); | |
$now = $now * (1.0 / (24.0 * 60.0)); | |
$rgb_array = HSV_TO_RGB($now, 0.5, 0.5); | |
$rgb = dechex($rgb_array['R']) . dechex($rgb_array['G']) . dechex($rgb_array['B']); | |
return ($rgb); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bezier(pts) { | |
return function (t) { | |
for (var a = pts; a.length > 1; a = b) // do..while loop in disguise | |
for (var i = 0, b = [], j; i < a.length - 1; i++) // cycle over control points | |
for (b[i] = [], j = 0; j < a[i].length; j++) // cycle over dimensions | |
b[i][j] = a[i][j] * (1 - t) + a[i+1][j] * t; // interpolation | |
return a[0]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
pre{ | |
margin: 0; | |
padding: 7px 0; | |
} | |
</style> | |
<?php | |
function rgb2hsv ($RGB) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct script access.'); | |
class Color { | |
public static function hex_to_rgb($hex){ | |
$pattern = '/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/'; | |
preg_match($pattern, $hex, $matches); | |
$matches = array_slice($matches, 1); | |
if (!function_exists('map')){ | |
function map($value){ |
NewerOlder