PHP Classes

File: tests/Concerns/ExtractsColorsFromImageTest.php

Recommend this page to a friend!
  Packages of tomloprod   Colority   tests/Concerns/ExtractsColorsFromImageTest.php   Download  
File: tests/Concerns/ExtractsColorsFromImageTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Colority
Perform color transformation operations
Author: By
Last change:
Date: 7 months ago
Size: 545 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

it('getImageMostCommonColor -> fixed image with color pixels')->todo();

test('getImageColors can obtain image colors', function (): void {

   
$imageColors = colority()->getImageColors(__DIR__.'/image-colors.png');

   
$hexImageColors = [];
    foreach (
$imageColors as $imageColor) {
       
$hexImageColors[] = $imageColor->toHex()->getValueColor();
    }

    foreach ([
'#ff0101', '#18ff01', '#014bff', '#ffcb01'] as $hexColor) {
       
expect(in_array($hexColor, $hexImageColors))->toBeTrue();
    }
});