_color_unpack

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 _color_unpack($hex, $normalize = false)
drupal7 _color_unpack($hex, $normalize = FALSE)

Convert a hex color into an RGB triplet.

▾ 3 functions call _color_unpack()

_color_blend in modules/color/color.module
Blend two hex colors and return the GD color.
_color_gd in modules/color/color.module
Convert a hex triplet into a GD color.
_color_shift in modules/color/color.module
Shift a given color, using a reference pair and a target blend color.

Code

modules/color/color.module, line 601

<?php
function _color_unpack($hex, $normalize = false) {
  if (strlen($hex) == 4) {
    $hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
  }
  $c = hexdec($hex);
  for ($i = 16; $i >= 0; $i -= 8) {
    $out[] = (($c >> $i) & 0xFF) / ($normalize ? 255 : 1);
  }
  return $out;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen