You are here

function _gd_image_chart_html2rgb in Charts 6

3 calls to _gd_image_chart_html2rgb()
gd_image_chart_image in gd_image_chart/gd_image_chart.inc
_gd_image_chart_line2d in gd_image_chart/gd_image_chart.inc
_gd_image_chart_vbar2d in gd_image_chart/gd_image_chart.inc

File

gd_image_chart/gd_image_chart.inc, line 217
@author Mads Peter Henderson http://drupal.org/user/421971

Code

function _gd_image_chart_html2rgb($color) {
  if ($color[0] == '#') {
    $color = substr($color, 1);
  }
  if (strlen($color) == 6) {
    list($r, $g, $b) = array(
      $color[0] . $color[1],
      $color[2] . $color[3],
      $color[4] . $color[5],
    );
  }
  elseif (strlen($color) == 3) {
    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 array(
    $r,
    $g,
    $b,
  );
}