ProPhoto RGB

The professional photography gamut, wider than any display.

Channels
  • R Red 0 to 1
  • G Green 0 to 1
  • B Blue 0 to 1
CSS syntax
color(prophoto-rgb ...)
White point
D50
Category
RGB
PHP class
ProPhotoColor
Reach for it when
RAW photo editing headroom.

Convert to ProPhoto RGB in PHP

Any color converts with to(); the result is ProPhoto RGB, an object with its own channels.

<?php

$color = Color::parse('#3b82f6')->to('prophoto-rgb');

$color->getChannels();
// ['r' => 0.4381, 'g' => 0.4369, 'b' => 0.8984]
$color = Color::parse('#3b82f6')->to('prophoto-rgb'); $color->getChannels(); // ['r' => 0.4381, 'g' => 0.4369, 'b' => 0.8984]

Parse ProPhoto RGB in PHP

The regular CSS syntax goes straight into Color::parse().

<?php

$color = Color::parse('color(prophoto-rgb 0.36 0.45 0.9)');

$color->toHex(); // #008af6
$color = Color::parse('color(prophoto-rgb 0.36 0.45 0.9)'); $color->toHex(); // #008af6

Export ProPhoto RGB in CSS

Every color object serializes back to the CSS form of its space.

<?php

Color::parse('#3b82f6')->to('prophoto-rgb')->toCss();
// color(prophoto-rgb 0.438114 0.436876 0.898388)
Color::parse('#3b82f6')->to('prophoto-rgb')->toCss(); // color(prophoto-rgb 0.438114 0.436876 0.898388)

Validate ProPhoto RGB

tryFrom() returns null on invalid input instead of throwing.

<?php

Color::tryFrom('color(prophoto-rgb 0.36 0.45 0.9)'); // instance

Color::tryFrom('color(nope)'); // null
Color::tryFrom('color(prophoto-rgb 0.36 0.45 0.9)'); // instance Color::tryFrom('color(nope)'); // null