diff options
author | Joas Schilling <coding@schilljs.com> | 2022-04-26 09:06:20 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-04-26 09:08:13 +0300 |
commit | b61aaedc144acc05f6ece9c92602c559e9176734 (patch) | |
tree | 4bf46c91cdcd1890314f1bbe42059b0d59258fc8 | |
parent | 1c75f64275eb6e9bfc3ffa8a6b83aa4dacc6d54c (diff) |
Update .gitignore
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | mexitek/phpcolors/.gitignore | 5 | ||||
-rw-r--r-- | mexitek/phpcolors/.phpcs.xml | 10 | ||||
-rw-r--r-- | mexitek/phpcolors/README.md | 173 | ||||
-rw-r--r-- | mexitek/phpcolors/composer.json | 37 | ||||
-rw-r--r-- | mexitek/phpcolors/demo/demo.php | 94 | ||||
-rw-r--r-- | mexitek/phpcolors/demo/phpColor-demo.png | bin | 27634 -> 0 bytes | |||
-rw-r--r-- | mexitek/phpcolors/tests/bootstrap.php | 11 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorAnalyze.phpt | 35 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorChange.phpt | 28 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorComplementary.phpt | 28 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorConvertHslToHex.phpt | 72 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorConvertNameToHex.phpt | 170 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorConvertRgbToHex.phpt | 72 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorInput.phpt | 19 | ||||
-rw-r--r-- | mexitek/phpcolors/tests/colorMix.phpt | 24 |
16 files changed, 7 insertions, 778 deletions
@@ -124,6 +124,13 @@ james-heinrich/getid3/helperapps league/flysystem/SECURITY.md league/flysystem/deprecations.md +mexitek/phpcolors/demo +mexitek/phpcolors/tests +mexitek/phpcolors/.gitignore +mexitek/phpcolors/.phpcs.xml +mexitek/phpcolors/composer.json +mexitek/phpcolors/README.md + mikey179/vfsstream mtdowling/jmespath.php/tests diff --git a/mexitek/phpcolors/.gitignore b/mexitek/phpcolors/.gitignore deleted file mode 100644 index e0a46244..00000000 --- a/mexitek/phpcolors/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.bak -*.*.bak -vendor/* -composer.lock -.idea diff --git a/mexitek/phpcolors/.phpcs.xml b/mexitek/phpcolors/.phpcs.xml deleted file mode 100644 index bba9c9f7..00000000 --- a/mexitek/phpcolors/.phpcs.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHPColors" - xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"> - <description>The coding standard for PHPColors.</description> - - <file>./src</file> - <file>./tests</file> - - <rule ref="PSR12"/> -</ruleset> diff --git a/mexitek/phpcolors/README.md b/mexitek/phpcolors/README.md deleted file mode 100644 index 8e3420f2..00000000 --- a/mexitek/phpcolors/README.md +++ /dev/null @@ -1,173 +0,0 @@ -# PHPColors [![Build Status](https://travis-ci.org/mexitek/phpColors.svg?branch=master)](https://travis-ci.org/mexitek/phpColors) - -> A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly. - -## Requirements - -PHPColors requires PHP version 7.2.0 or greater. - -## Installation - -### Composer - -Simply add `mexitek/phpcolors` to `composer.json` using `dev-master`. - -``` -composer require mexitek/phpcolors:dev-master -``` - -## How it works -Instantiate an object of the color class with a hex color string `$foo = new Color("336699")`. That's it! Now, call the methods you need for different color variants. - -## Available Methods -- <strong>darken( [$amount] )</strong> : Allows you to obtain a darker shade of your color. Optionally you can decide to darken using a desired percentage. -- <strong>lighten( [$amount] )</strong> : Allows you to obtain a lighter shade of your color. Optionally you can decide to lighten using a desired percentage. -- <strong>mix($hex, [$amount] )</strong> : Allows you to mix another color to your color. Optionally you can decide to set the percent of second color or original color amount is ranged -100...0...100. -- <strong>isLight( [$hex] )</strong> : Determins whether your color (or the provide param) is considered a "light" color. Returns `TRUE` if color is light. -- <strong>isDark( [$hex] )</strong> : Determins whether your color (or the provide param) is considered a "dark" color. Returns `TRUE` if color is dark. -- <strong>makeGradient( [$amount] )</strong> : Returns an array with 2 indices `light` and `dark`, the initial color will either be selected for `light` or `dark` depending on its brightness, then the other color will be generated. The optional param allows for a static lighten or darkened amount. -- <strong>complementary()</strong> : Returns the color "opposite" or complementary to your color. -- <strong>getHex()</strong> : Returns the original hex color. -- <strong>getHsl()</strong> : Returns HSL array for your color. -- <strong>getRgb()</strong> : Returns RGB array for your color. - -> Auto lightens/darkens by 10% for sexily-subtle gradients - -```php -/** - * Using The Class - */ - -use Mexitek\PHPColors\Color; - -// Initialize my color -$myBlue = new Color("#336699"); - -echo $myBlue->darken(); -// 1a334d - -echo $myBlue->lighten(); -// 8cb3d9 - -echo $myBlue->isLight(); -// false - -echo $myBlue->isDark(); -// true - -echo $myBlue->complementary(); -// 996633 - -echo $myBlue->getHex(); -// 336699 - -print_r( $myBlue->getHsl() ); -// array( "H"=> 210, "S"=> 0.5, "L"=>0.4 ); - -print_r( $myBlue->getRgb() ); -// array( "R"=> 51, "G"=> 102, "B"=>153 ); - -print_r($myBlue->makeGradient()); -// array( "light"=>"8cb3d9" ,"dark"=>"336699" ) - -``` - - -## Static Methods -- <strong>hslToHex( $hsl )</strong> : Convert a HSL array to a HEX string. -- <strong>hexToHsl( $hex )</strong> : Convert a HEX string into an HSL array. -- <strong>hexToRgb( $hex )</strong> : Convert a HEX string into an RGB array. -- <strong>rgbToHex( $rgb )</strong> : Convert an RGB array into a HEX string. - -```php -/** - * On The Fly Custom Calculations - */ - -use Mexitek\PHPColors\Color; - - // Convert my HEX - $myBlue = Color::hexToHsl("#336699"); - - // Get crazy with the HUE - $myBlue["H"] = 295; - - // Gimme my new color!! - echo Color::hslToHex($myBlue); - // 913399 - -``` - -## CSS Helpers -- <strong>getCssGradient( [$amount] [, $vintageBrowsers] )</strong> : Generates the CSS3 gradients for safari, chrome, opera, firefox and IE10. Optional percentage amount for lighter/darker shade. Optional boolean for older gradient CSS support. - -> Would like to add support to custom gradient stops - -```php - -use Mexitek\PHPColors\Color; - -// Initialize my color -$myBlue = new Color("#336699"); - -// Get CSS -echo $myBlue->getCssGradient(); -/* - Actual output doesn't have comments and is single line - - // fallback background - background: #336699; - - // IE Browsers - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb3d9', endColorstr='#336699'); - - // Safari 5.1+, Mobile Safari, Chrome 10+ - background-image: -webkit-linear-gradient(top, #8cb3d9, #336699); - - // Standards - background-image: linear-gradient(to bottom, #8cb3d9, #336699); - -*/ - -``` - -However, if you want to support the ancient browsers (which has negligible market share and almost died out), you can set the second parameter to `TRUE`. This will output: - -```php - -use Mexitek\PHPColors\Color; -$myBlue = new Color("#336699"); - -// Get CSS -echo $myBlue->getCssGradient(10, TRUE); -/* - Actual output doesn't have comments and is single line - - background: #336699; // fallback background - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8cb3d9', endColorstr='#336699'); // IE Browsers - background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#8cb3d9), to(#336699)); // Safari 4+, Chrome 1-9 - background-image: -webkit-linear-gradient(top, #8cb3d9, #336699); // Safari 5.1+, Mobile Safari, Chrome 10+ - background-image: -moz-linear-gradient(top, #8cb3d9, #336699); // Firefox 3.6+ - background-image: -o-linear-gradient(top, #8cb3d9, #336699); // Opera 11.10+ - background-image: linear-gradient(to bottom, #8cb3d9, #336699); // Standards - -*/ - -``` - -## Github Contributors -- mexitek -- danielpataki -- alexmglover -- intuxicated -- pborreli -- curtisgibby -- matthewpatterson -- there4 -- alex-humphreys -- zaher -- primozcigler -- thedavidmeister -- tylercd100 -- Braunson - -# License -See LICENSE file or [arlo.mit-license.org](http://arlo.mit-license.org) diff --git a/mexitek/phpcolors/composer.json b/mexitek/phpcolors/composer.json deleted file mode 100644 index 8d074f75..00000000 --- a/mexitek/phpcolors/composer.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "mexitek/phpcolors", - "description": "A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.", - "type": "library", - "keywords": [ - "color", - "ui", - "css", - "frontend", - "design" - ], - "homepage": "http://mexitek.github.com/phpColors/", - "license": "MIT", - "authors": [ - { - "name": "Arlo Carreon", - "homepage": "http://arlocarreon.com", - "role": "creator" - } - ], - "support": { - "issues": "https://github.com/mexitek/phpColors/issues", - "source": "https://github.com/mexitek/phpColors" - }, - "require": { - "php": "^7.2|^8.0" - }, - "require-dev": { - "nette/tester": "^2.3", - "squizlabs/php_codesniffer": "^3.5" - }, - "autoload": { - "classmap": [ - "src" - ] - } -} diff --git a/mexitek/phpcolors/demo/demo.php b/mexitek/phpcolors/demo/demo.php deleted file mode 100644 index 825cf084..00000000 --- a/mexitek/phpcolors/demo/demo.php +++ /dev/null @@ -1,94 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <title>phpColors Demo</title> - <?php - - require_once __DIR__ . '/../src/Mexitek/PHPColors/Color.php'; - - use Mexitek\PHPColors\Color; - - // Use different colors to test - $myBlue = new Color("#336699"); - $myBlack = new Color("#333"); - $myPurple = new Color("#913399"); - $myVintage = new Color("#bada55"); - - // ************** No Need to Change Below ********************** - ?> - <style> - .block { - height: 100px; - width: 200px; - font-size: 20px; - text-align: center; - padding-top: 100px; - display: block; - margin: 0; - float: left; - } - - .wide-block { - width: 360px; - padding-top: 70px; - padding-left: 20px; - padding-right: 20px; - margin-top: 10px; - } - - .clear { - clear: both; - } - - .testDiv { - <?= $myBlue->getCssGradient()?> - color: <?=($myBlue->isDark() ? "#EEE":"#333")?>; - } - - .testDiv.plain { - background: #<?= $myBlue->getHex()?>; - color: <?=($myBlue->isDark() ? "#EEE":"#333")?>; - } - - .testDiv2 { - <?= $myBlack->getCssGradient()?> - color: <?=($myBlack->isDark() ? "#EEE":"#333")?>; - } - - .testDiv2.plain { - background: #<?= $myBlack->getHex();?>; - color: <?=($myBlack->isDark() ? "#EEE":"#333")?>; - } - - .testDiv3 { - <?= $myPurple->getCssGradient()?> - color: <?=($myPurple->isDark() ? "#EEE":"#333")?>; - } - - .testDiv3.plain { - background: #<?= $myPurple->getHex()?>; - color: <?=($myPurple->isDark() ? "#EEE":"#333")?>; - } - - .testDiv4 { - <?= $myVintage->getCssGradient(30, true)?> - color: <?=($myVintage->isDark() ? "#EEE":"#333")?>; - } - </style> -</head> -<body> -<div class="clear"></div> -<div class="block testDiv">phpColor Gradient #<?= $myBlue->getHex() ?></div> -<div class="block testDiv plain">Plain #<?= $myBlue->getHex() ?></div> -<div class="clear"></div> -<div class="block testDiv2">phpColor Gradient #<?= $myBlack->getHex() ?></div> -<div class="block testDiv2 plain">Plain #<?= $myBlack->getHex() ?></div> -<div class="clear"></div> -<div class="block testDiv3">phpColor Gradient #<?= $myPurple->getHex() ?></div> -<div class="block testDiv3 plain">Plain #<?= $myPurple->getHex() ?></div> -<div class="clear"></div> -<div class="block wide-block testDiv4"> - phpColor Gradient with vintage browsers support #<?= $myVintage->getHex() ?> -</div> -</body> -</html> diff --git a/mexitek/phpcolors/demo/phpColor-demo.png b/mexitek/phpcolors/demo/phpColor-demo.png Binary files differdeleted file mode 100644 index b1fbdbca..00000000 --- a/mexitek/phpcolors/demo/phpColor-demo.png +++ /dev/null diff --git a/mexitek/phpcolors/tests/bootstrap.php b/mexitek/phpcolors/tests/bootstrap.php deleted file mode 100644 index 84607960..00000000 --- a/mexitek/phpcolors/tests/bootstrap.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -require __DIR__ . '/../vendor/autoload.php'; -require __DIR__ . '/../src/Mexitek/PHPColors/Color.php'; - -if (!class_exists('Tester\Assert')) { - echo "Install Nette Tester using `composer update --dev`\n"; - exit(1); -} - -Tester\Environment::setup(); diff --git a/mexitek/phpcolors/tests/colorAnalyze.phpt b/mexitek/phpcolors/tests/colorAnalyze.phpt deleted file mode 100644 index 1f7ff47a..00000000 --- a/mexitek/phpcolors/tests/colorAnalyze.phpt +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - - -$isDark = array( - "000000" => true, - "336699" => true, - "913399" => true, - "E5C3E8" => false, - "D7E8DD" => false, - "218A47" => true, - "3D41CA" => true, - "E5CCDD" => false, - "FFFFFF" => false, -); - -foreach ($isDark as $colorHex => $state) { - $color = new Color($colorHex); - Assert::same($state, $color->isDark(), 'Incorrect dark color analyzed (#' . $colorHex . ').'); -} - -$isLight = array( - "FFFFFF" => true, - "A3FFE5" => true, - "000000" => false, -); - -foreach ($isLight as $colorHex => $state) { - $color = new Color($colorHex); - Assert::same($state, $color->isLight(), 'Incorrect light color analyzed (#' . $colorHex . ').'); -} diff --git a/mexitek/phpcolors/tests/colorChange.phpt b/mexitek/phpcolors/tests/colorChange.phpt deleted file mode 100644 index 373f34ef..00000000 --- a/mexitek/phpcolors/tests/colorChange.phpt +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - - -$expected = array( - "336699" => "264d73", - "913399" => "6d2673" -); - -foreach ($expected as $original => $darker) { - $color = new Color($original); - Assert::same($darker, $color->darken(), 'Incorrect darker color returned.'); -} - - -$expected = array( - "336699" => "4080bf", - "913399" => "b540bf" -); - -foreach ($expected as $original => $lighter) { - $color = new Color($original); - Assert::same($lighter, $color->lighten(), "Incorrect lighter color returned."); -} diff --git a/mexitek/phpcolors/tests/colorComplementary.phpt b/mexitek/phpcolors/tests/colorComplementary.phpt deleted file mode 100644 index 2876b5c8..00000000 --- a/mexitek/phpcolors/tests/colorComplementary.phpt +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - - -$expected = array( - "ff0000" => "00ffff", - "0000ff" => "ffff00", - "00ff00" => "ff00ff", - "ffff00" => "0000ff", - "00ffff" => "ff0000", - "49cbaf" => "cb4965", - "003eb2" => "b27400", - "b27400" => "003eb2", - "ffff99" => "9999ff", - "ccff00" => "3300ff", - "3300ff" => "ccff00", - "fb4a2c" => "2cddfb", - "9cebff" => "ffb09c", -); - -foreach ($expected as $original => $complementary) { - $color = new Color($original); - Assert::same($complementary, $color->complementary(), 'Incorrect complementary color returned.'); -} diff --git a/mexitek/phpcolors/tests/colorConvertHslToHex.phpt b/mexitek/phpcolors/tests/colorConvertHslToHex.phpt deleted file mode 100644 index fd3adbd0..00000000 --- a/mexitek/phpcolors/tests/colorConvertHslToHex.phpt +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - -// Colors in HSL, for testing. -$blue = [ - 'H' => 194, - 'S' => 1.0, - 'L' => 0.4, -]; -$yellow = [ - 'H' => 57, - 'S' => 0.91, - 'L' => 0.51, -]; -$black = [ - 'H' => 0, - 'S' => 0.0, - 'L' => 0.0, -]; -$grey = [ - 'H' => 0, - 'S' => 0.0, - 'L' => 0.65, -]; -$white = [ - 'H' => 0, - 'S' => 0.0, - 'L' => 1.0, -]; - -// Test cases. -$colorsToConvert = array( - 'blue' => [ // hsl(194, 100%, 40%) - 'hex' => '009ccc', - 'hsl' => $blue, - ], - 'yellow' => [ // hsl(57, 91%, 51%) - 'hex' => 'f4e810', - 'hsl' => $yellow, - ], - 'black' => [ - 'hex' => '000000', - 'hsl' => $black, - ], - 'grey' => [ - 'hex' => 'a6a6a6', - 'hsl' => $grey, - ], - 'white' => [ - 'hex' => 'ffffff', - 'hsl' => $white, - ], -); - - -foreach ($colorsToConvert as $color) { - $hsl = $color['hsl']; - $hex = $color['hex']; - - $answer = Color::hslToHex($hsl); - Assert::same( - $hex, - $answer, - 'Incorrect hex result: "' . json_encode($hsl) . - '" should convert to "' . $hex . - '", but output was: "' . $answer . '".' - ); -} diff --git a/mexitek/phpcolors/tests/colorConvertNameToHex.phpt b/mexitek/phpcolors/tests/colorConvertNameToHex.phpt deleted file mode 100644 index e4f87ca7..00000000 --- a/mexitek/phpcolors/tests/colorConvertNameToHex.phpt +++ /dev/null @@ -1,170 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - -// Test cases. -$colorsToConvert = array( - 'aliceblue' => 'F0F8FF', - 'antiquewhite' => 'FAEBD7', - 'aqua' => '00FFFF', - 'aquamarine' => '7FFFD4', - 'azure' => 'F0FFFF', - 'beige' => 'F5F5DC', - 'bisque' => 'FFE4C4', - 'black' => '000000', - 'blanchedalmond' => 'FFEBCD', - 'blue' => '0000FF', - 'blueviolet' => '8A2BE2', - 'brown' => 'A52A2A', - 'burlywood' => 'DEB887', - 'cadetblue' => '5F9EA0', - 'chartreuse' => '7FFF00', - 'chocolate' => 'D2691E', - 'coral' => 'FF7F50', - 'cornflowerblue' => '6495ED', - 'cornsilk' => 'FFF8DC', - 'crimson' => 'DC143C', - 'cyan' => '00FFFF', - 'darkblue' => '00008B', - 'darkcyan' => '008B8B', - 'darkgoldenrod' => 'B8860B', - 'darkgray' => 'A9A9A9', - 'darkgreen' => '006400', - 'darkgrey' => 'A9A9A9', - 'darkkhaki' => 'BDB76B', - 'darkmagenta' => '8B008B', - 'darkolivegreen' => '556B2F', - 'darkorange' => 'FF8C00', - 'darkorchid' => '9932CC', - 'darkred' => '8B0000', - 'darksalmon' => 'E9967A', - 'darkseagreen' => '8FBC8F', - 'darkslateblue' => '483D8B', - 'darkslategray' => '2F4F4F', - 'darkslategrey' => '2F4F4F', - 'darkturquoise' => '00CED1', - 'darkviolet' => '9400D3', - 'deeppink' => 'FF1493', - 'deepskyblue' => '00BFFF', - 'dimgray' => '696969', - 'dimgrey' => '696969', - 'dodgerblue' => '1E90FF', - 'firebrick' => 'B22222', - 'floralwhite' => 'FFFAF0', - 'forestgreen' => '228B22', - 'fuchsia' => 'FF00FF', - 'gainsboro' => 'DCDCDC', - 'ghostwhite' => 'F8F8FF', - 'gold' => 'FFD700', - 'goldenrod' => 'DAA520', - 'gray' => '808080', - 'green' => '008000', - 'greenyellow' => 'ADFF2F', - 'grey' => '808080', - 'honeydew' => 'F0FFF0', - 'hotpink' => 'FF69B4', - 'indianred' => 'CD5C5C', - 'indigo' => '4B0082', - 'ivory' => 'FFFFF0', - 'khaki' => 'F0E68C', - 'lavender' => 'E6E6FA', - 'lavenderblush' => 'FFF0F5', - 'lawngreen' => '7CFC00', - 'lemonchiffon' => 'FFFACD', - 'lightblue' => 'ADD8E6', - 'lightcoral' => 'F08080', - 'lightcyan' => 'E0FFFF', - 'lightgoldenrodyellow' => 'FAFAD2', - 'lightgray' => 'D3D3D3', - 'lightgreen' => '90EE90', - 'lightgrey' => 'D3D3D3', - 'lightpink' => 'FFB6C1', - 'lightsalmon' => 'FFA07A', - 'lightseagreen' => '20B2AA', - 'lightskyblue' => '87CEFA', - 'lightslategray' => '778899', - 'lightslategrey' => '778899', - 'lightsteelblue' => 'B0C4DE', - 'lightyellow' => 'FFFFE0', - 'lime' => '00FF00', - 'limegreen' => '32CD32', - 'linen' => 'FAF0E6', - 'magenta' => 'FF00FF', - 'maroon' => '800000', - 'mediumaquamarine' => '66CDAA', - 'mediumblue' => '0000CD', - 'mediumorchid' => 'BA55D3', - 'mediumpurple' => '9370D0', - 'mediumseagreen' => '3CB371', - 'mediumslateblue' => '7B68EE', - 'mediumspringgreen' => '00FA9A', - 'mediumturquoise' => '48D1CC', - 'mediumvioletred' => 'C71585', - 'midnightblue' => '191970', - 'mintcream' => 'F5FFFA', - 'mistyrose' => 'FFE4E1', - 'moccasin' => 'FFE4B5', - 'navajowhite' => 'FFDEAD', - 'navy' => '000080', - 'oldlace' => 'FDF5E6', - 'olive' => '808000', - 'olivedrab' => '6B8E23', - 'orange' => 'FFA500', - 'orangered' => 'FF4500', - 'orchid' => 'DA70D6', - 'palegoldenrod' => 'EEE8AA', - 'palegreen' => '98FB98', - 'paleturquoise' => 'AFEEEE', - 'palevioletred' => 'DB7093', - 'papayawhip' => 'FFEFD5', - 'peachpuff' => 'FFDAB9', - 'peru' => 'CD853F', - 'pink' => 'FFC0CB', - 'plum' => 'DDA0DD', - 'powderblue' => 'B0E0E6', - 'purple' => '800080', - 'red' => 'FF0000', - 'rosybrown' => 'BC8F8F', - 'royalblue' => '4169E1', - 'saddlebrown' => '8B4513', - 'salmon' => 'FA8072', - 'sandybrown' => 'F4A460', - 'seagreen' => '2E8B57', - 'seashell' => 'FFF5EE', - 'sienna' => 'A0522D', - 'silver' => 'C0C0C0', - 'skyblue' => '87CEEB', - 'slateblue' => '6A5ACD', - 'slategray' => '708090', - 'slategrey' => '708090', - 'snow' => 'FFFAFA', - 'springgreen' => '00FF7F', - 'steelblue' => '4682B4', - 'tan' => 'D2B48C', - 'teal' => '008080', - 'thistle' => 'D8BFD8', - 'tomato' => 'FF6347', - 'turquoise' => '40E0D0', - 'violet' => 'EE82EE', - 'wheat' => 'F5DEB3', - 'white' => 'FFFFFF', - 'whitesmoke' => 'F5F5F5', - 'yellow' => 'FFFF00', - 'yellowgreen' => '9ACD32' -); - -foreach ($colorsToConvert as $name => $hex) { - $hex = '#' . $hex; - - $answer = Color::nameToHex($name); - Assert::same( - $hex, - $answer, - 'Incorrect hex result: "' . Color::nameToHex($name) . - '" should convert to "' . $hex . - '", but output was: "' . $answer . '".' - ); -} diff --git a/mexitek/phpcolors/tests/colorConvertRgbToHex.phpt b/mexitek/phpcolors/tests/colorConvertRgbToHex.phpt deleted file mode 100644 index a65f1a7e..00000000 --- a/mexitek/phpcolors/tests/colorConvertRgbToHex.phpt +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - -// Colors in RGB, for testing. -$blue = [ - 'R' => 0, - 'G' => 158, - 'B' => 204, -]; -$yellow = [ - 'R' => 244, - 'G' => 231, - 'B' => 15, -]; -$black = [ - 'R' => 0, - 'G' => 0, - 'B' => 0, -]; -$white = [ - 'R' => 255, - 'G' => 255, - 'B' => 255, -]; - -// Test cases. -$colorsToConvert = array( - 'blue' => [ // rgb(0, 158, 204) - 'hex' => '009ecc', - 'rgb' => $blue, - ], - 'yellow' => [ // rgb(244, 231, 15) - 'hex' => 'f4e70f', - 'rgb' => $yellow, - ], - 'black' => [ - 'hex' => '000000', - 'rgb' => $black, - ], - 'white' => [ - 'hex' => 'ffffff', - 'rgb' => $white, - ], -); - - -foreach ($colorsToConvert as $color) { - $rgb = $color['rgb']; - $hex = $color['hex']; - - $answer = Color::rgbToHex($rgb); - Assert::same( - $hex, - $answer, - 'Incorrect hex result: "' . Color::rgbToString($rgb) . - '" should convert to "' . $hex . - '", but output was: "' . $answer . '".' - ); - - $revertAnswer = Color::hexToRgb($hex); - Assert::same( - $rgb, - $revertAnswer, - 'Incorrect rgb result: "' . $hex . - '" should convert to "' . Color::rgbToString($rgb) . - '", but output was: "' . Color::rgbToString($revertAnswer) . '".' - ); -} diff --git a/mexitek/phpcolors/tests/colorInput.phpt b/mexitek/phpcolors/tests/colorInput.phpt deleted file mode 100644 index 8ace3057..00000000 --- a/mexitek/phpcolors/tests/colorInput.phpt +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - -// Test that a hex starting with '#' is supported as input -$expected = array( - "#ffffff", - "#00ff00", - "#000000", - "#ff9a00", -); - -foreach ($expected as $input) { - $color = new Color($input); - Assert::same((string) $color, $input, 'Incorrect color returned.'); -} diff --git a/mexitek/phpcolors/tests/colorMix.phpt b/mexitek/phpcolors/tests/colorMix.phpt deleted file mode 100644 index 60294771..00000000 --- a/mexitek/phpcolors/tests/colorMix.phpt +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -require __DIR__ . '/bootstrap.php'; - -use Mexitek\PHPColors\Color; -use Tester\Assert; - - -$expected = array( - "ffffff" => array("ff0000", "ff7f7f"), // ffffff + ff0000 = ff7f7f - "00ff00" => array("ff0000", "7f7f00"), - "000000" => array("ff0000", "7f0000"), - "002fff" => array("000000", "00177f"), - "00ffed" => array("000000", "007f76"), - "ff9a00" => array("000000", "7f4d00"), - "ff9a00" => array("ffffff", "ffcc7f"), - "00ff2d" => array("ffffff", "7fff96"), - "8D43B4" => array("35CF64", "61898c"), -); - -foreach ($expected as $original => $complementary) { - $color = new Color($original); - Assert::same($complementary[1], $color->mix($complementary[0]), 'Incorrect mix color returned.'); -} |