-
Notifications
You must be signed in to change notification settings - Fork 8
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.
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.
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);
Copyright © 2016 Nicholas Jordon
This documentation is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.