_color_pack

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 _color_pack($rgb, $normalize = false)
drupal7 _color_pack($rgb, $normalize = FALSE)

Convert an RGB triplet to a hex color.

▾ 1 function calls _color_pack()

_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 615

<?php
function _color_pack($rgb, $normalize = false) {
  $out = 0;
  foreach ($rgb as $k => $v) {
    $out |= (($v * ($normalize ? 255 : 1)) << (16 - $k * 8));
  }
  return '#' . str_pad(dechex($out), 6, 0, STR_PAD_LEFT);
}
?>

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