You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

colorAnalyze.phpt 768B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. require __DIR__ . '/bootstrap.php';
  3. use Mexitek\PHPColors\Color;
  4. use Tester\Assert;
  5. $isDark = array(
  6. "000000" => true,
  7. "336699" => true,
  8. "913399" => true,
  9. "E5C3E8" => false,
  10. "D7E8DD" => false,
  11. "218A47" => true,
  12. "3D41CA" => true,
  13. "E5CCDD" => false,
  14. "FFFFFF" => false,
  15. );
  16. foreach ($isDark as $colorHex => $state) {
  17. $color = new Color($colorHex);
  18. Assert::same($state, $color->isDark(), 'Incorrect dark color analyzed (#' . $colorHex . ').');
  19. }
  20. $isLight = array(
  21. "FFFFFF" => true,
  22. "A3FFE5" => true,
  23. "000000" => false,
  24. );
  25. foreach ($isLight as $colorHex => $state) {
  26. $color = new Color($colorHex);
  27. Assert::same($state, $color->isLight(), 'Incorrect light color analyzed (#' . $colorHex . ').');
  28. }