Generator so previous state is never mutated.
Alpha values throughout this package use a 0–100 scale (0 = fully opaque,
100 = fully transparent). The package converts this internally to the range
PHP’s GD library expects (0–127). You do not need to perform this conversion
yourself.
color()
int
required
RGB mode: Red channel, 0–255. CMYK mode: Cyan channel, 0–100.
int
required
RGB mode: Green channel, 0–255. CMYK mode: Magenta channel, 0–100.
int
required
RGB mode: Blue channel, 0–255. CMYK mode: Yellow channel, 0–100.
int | null
RGB mode: Alpha channel, 0–100 (0 = fully opaque). CMYK mode: Black
(Key) channel, 0–100. Omit for a fully opaque foreground.
backgroundColor()
color() and respects the active color model.
int
required
RGB mode: Red, 0–255. CMYK mode: Cyan, 0–100.
int
required
RGB mode: Green, 0–255. CMYK mode: Magenta, 0–100.
int
required
RGB mode: Blue, 0–255. CMYK mode: Yellow, 0–100.
int | null
RGB mode: Alpha, 0–100. CMYK mode: Black, 0–100. Omit for a fully
opaque background.
rgb()
cmyk()
color() and backgroundColor() interpret channel values on a 0–100 scale (percentage).
gray()
GRAY.
int
required
Foreground luminance:
0 = black, 100 = white.int | null
Background luminance on the same 0–100 scale. When
null, the background
defaults to white (100).gradient()
string | array
required
The gradient start color. Pass a hex string (e.g.
'#3b82f6') or an RGB array
(e.g. [59, 130, 246]).string | array
required
The gradient end color. Accepts the same formats as
start.string
required
The gradient direction. Accepted values:
gradient() takes color values directly rather than using whatever was set by
a prior color() call. The gradient replaces the foreground color entirely.