AnsPress_Avatar::hex_to_rgb( string $color )
Description #
Convert hex value to rgb.
Parameters #
- $colorstring (Required) Hex color.
Source #
File: addons/free/avatar.php
protected function hex_to_rgb( $color ) { if ( '#' === $color[0] ) { $color = substr( $color, 1 ); } if ( 6 === strlen( $color ) ) { list( $r, $g, $b ) = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( 3 === strlen( $color ) ) { list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return false; } $r = hexdec( $r ); $g = hexdec( $g ); $b = hexdec( $b ); return [ 'r' => $r, 'g' => $g, 'b' => $b ]; }
Expand full source code Collapse full source code View on GitHub: addons/free/avatar.php:380
Add your comment