ColorVisionSimulator
Simulator for various types of color vision deficiency.
Uses transformation matrices to approximate how colors appear to people with
different types of color blindness.
Methods
public function areDistinguishable(ColorInterface $first, ColorInterface $second, VisionProfile $profile, float $threshold): bool
Check if two colors are distinguishable under a given vision profile.
Parameters
| Name | Type | Default |
|---|---|---|
$first |
ColorInterface | - |
$second |
ColorInterface | - |
$profile |
VisionProfile | null |
$threshold |
float | 0.06 |
create
static
public static function create(VisionProfile $profile): ColorVisionSimulator
Create a new vision simulator instance for a specific profile.
Parameters
| Name | Type | Default |
|---|---|---|
$profile |
VisionProfile | - |
public function simulate(ColorInterface $color, VisionProfile $profile): ColorInterface
Parameters
| Name | Type | Default |
|---|---|---|
$color |
ColorInterface | - |
$profile |
VisionProfile | null |
public function simulateAll(array $colors, VisionProfile $profile): array
Simulate vision deficiency for multiple colors.
Parameters
| Name | Type | Default |
|---|---|---|
$colors |
array | - |
$profile |
VisionProfile | null |