PHP Classes

File: vars/hex2short-colors.php

Recommend this page to a friend!
  Classes of Corey Hart   CSS Compressor   vars/hex2short-colors.php   Download  
File: vars/hex2short-colors.php
Role: Configuration script
Content type: text/plain
Description: Array for converting hex to short color names
Class: CSS Compressor
Compact the size of CSS definitions
Author: By
Last change: -Better options handling
-Look behind regexs are used to not break urls
-Singleton access added
-Exposing byte unit conversion display
-The compressor no longer self instantiates itself, you must explicitly initialize it.
-Most methods that were never meant to be public, have been turned into private/protected based on accessibility requirements.
Date: 14 years ago
Size: 951 bytes
 

Contents

Class file image Download
<?php
/**
 * CSS Compressor [VERSION]
 * [DATE]
 * Corey Hart @ http://www.codenothing.com
 */

// Hex codes to short names
$hex2short = array(
   
"#f0ffff" => "azure",
   
"#f5f5dc" => "beige",
   
"#ffe4c4" => "bisque",
   
"#a52a2a" => "brown",
   
"#ff7f50" => "coral",
   
"#ffd700" => "gold",
   
"#808080" => "gray",
   
"#008000" => "green",
   
"#4b0082" => "indigo",
   
"#fffff0" => "ivory",
   
"#f0e68c" => "khaki",
   
"#faf0e6" => "linen",
   
"#800000" => "maroon",
   
"#000080" => "navy",
   
"#808000" => "olive",
   
"#ffa500" => "orange",
   
"#da70d6" => "orchid",
   
"#cd853f" => "peru",
   
"#ffc0cb" => "pink",
   
"#dda0dd" => "plum",
   
"#800080" => "purple",
   
"#ff0000" => "red",
   
"#fa8072" => "salmon",
   
"#a0522d" => "sienna",
   
"#c0c0c0" => "silver",
   
"#fffafa" => "snow",
   
"#d2b48c" => "tan",
   
"#008080" => "teal",
   
"#ff6347" => "tomato",
   
"#ee82ee" => "violet",
   
"#f5deb3" => "wheat",

   
// Red is the only string value that is less than the 3# hex value
   
"#f00" => "red",
);

?>