Skip to content

04 – Importing A Color

Nicholas Jordon edited this page Sep 24, 2016 · 5 revisions

Importing a color is fairly straight forward, and can be done several ways.

Importing String & Integer Values

Strings and integers are always assumed to be Hexadecimal values. Strings can be either be 3 or 6 characters long, and can be optionally prefixed with a octothorpe (#). Integers are interpreted as PHP hexadecimals but can be represented as any integer that PHP can interpret.

Example

use \projectcleverweb\color\main as color;

// The below all result in the same object
$color = new color('#333333');
$color = new color('#333');
$color = new color('333333');
$color = new color('333');
// NOTE: 0x333333 IS NOT the same as 0x333
$color = new color(0x333333);
$color = new color(3355443);

Importing Array Values

Handling Import Errors


Previous Page - Optimization & Caching     Next Page - The Alpha Channel

Clone this wiki locally