You are here

public function TwigColorTest::providerTestRgbToHexValues in Twig Tools 8

Provides test data for testMd5Value.

Return value

array An array of test data with twig values and their hex equivalents.

File

tests/src/Unit/TwigColorTest.php, line 48

Class

TwigColorTest
Tests to ensure color convert filters work correctly.

Namespace

Drupal\Tests\twig_tools\Unit

Code

public function providerTestRgbToHexValues() {
  return [
    [
      "{{ [255, 255, 255]|rgb_to_hex }}",
      '#ffffff',
    ],
    [
      "{{ [160, 198, 119]|rgb_to_hex }}",
      '#a0c677',
    ],
    [
      "{{ [142, 47, 47]|rgb_to_hex }}",
      '#8e2f2f',
    ],
    [
      "{{ [0, 0, 0]|rgb_to_hex }}",
      '#000000',
    ],
    [
      "{{ [-1, 0, 1]|rgb_to_hex }}",
      '',
    ],
    [
      "{{ [-142, -47, -47]|rgb_to_hex }}",
      '',
    ],
    [
      "{{ [256, 256, 256]|rgb_to_hex }}",
      '',
    ],
    [
      "{{ [1000, 1000, 1000]|rgb_to_hex }}",
      '',
    ],
    [
      "{{ [160, 198, 119, 233]|rgb_to_hex }}",
      '',
    ],
    [
      "{{ [160, 198]|rgb_to_hex }}",
      '',
    ],
    [
      "{{ [160]|rgb_to_hex }}",
      '',
    ],
  ];
}