Created
April 24, 2023 18:41
-
-
Save dartiss/256497353e67e4efd716e5cf64dec92e to your computer and use it in GitHub Desktop.
Color name to hex compression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tocolor = array( | |
'Black' => '#000', | |
'DarkBlue' => '#00008B', | |
'MediumBlue' => '#0000CD', | |
'DarkGreen' => '#006400', | |
'DarkCyan' => '#008B8B', | |
'DeepSkyBlue' => '#00BFFF', | |
'DarkTurquoise' => '#00CED1', | |
'MediumSpringGreen' => '#00FA9A', | |
'SpringGreen' => '#00FF7F', | |
'MidnightBlue' => '#191970', | |
'DodgerBlue' => '#1E90FF', | |
'LightSeaGreen' => '#20B2AA', | |
'ForestGreen' => '#228B22', | |
'SeaGreen' => '#2E8B57', | |
'DarkSlateGray' => '#2F4F4F', | |
'LimeGreen' => '#32CD32', | |
'MediumSeaGreen' => '#3CB371', | |
'Turquoise' => '#40E0D0', | |
'RoyalBlue' => '#4169E1', | |
'SteelBlue' => '#4682B4', | |
'DarkSlateBlue' => '#483D8B', | |
'MediumTurquoise' => '#48D1CC', | |
'DarkOliveGreen' => '#556B2F', | |
'CadetBlue' => '#5F9EA0', | |
'CornFlowerBlue' => '#6495ED', | |
'MediumAquaMarine' => '#66CDAA', | |
'SlateBlue' => '#6A5ACD', | |
'OliveDrab' => '#6B8E23', | |
'SlateGray' => '#708090', | |
'LightSlateGray' => '#778899', | |
'MediumSlateBlue' => '#7B68EE', | |
'LawnGreen' => '#7CFC00', | |
'Chartreuse' => '#7FFF00', | |
'AquaMarine' => '#7FFFD4', | |
'LightSkyBlue' => '#87CEFA', | |
'BlueViolet' => '#8A2BE2', | |
'DarkMagenta' => '#8B008B', | |
'SaddleBrown' => '#8B4513', | |
'DarkSeaGreen' => '#8FBC8F', | |
'LightGreen' => '#90EE90', | |
'MediumPurple' => '#9370DB', | |
'DarkViolet' => '#9400D3', | |
'PaleGreen' => '#98FB98', | |
'DarkOrchid' => '#9932CC', | |
'YellowGreen' => '#9ACD32', | |
'DarkGray' => '#A9A9A9', | |
'DarkGrey' => '#A9A9A9', | |
'LightBlue' => '#ADD8E6', | |
'GreenYellow' => '#ADFF2F', | |
'PaleTurquoise' => '#AFEEEE', | |
'LightSteelBlue' => '#B0C4DE', | |
'PowderBlue' => '#B0E0E6', | |
'Firebrick' => '#B22222', | |
'DarkGoldenRod' => '#B8860B', | |
'MediumOrchid' => '#BA55D3', | |
'RosyBrown' => '#BC8F8F', | |
'DarkKhaki' => '#BDB76B', | |
'MediumVioletRed' => '#C71585', | |
'IndianRed' => '#CD5C5C', | |
'Chocolate' => '#D2691E', | |
'LightGray' => '#D3D3D3', | |
'LightGrey' => '#D3D3D3', | |
'GoldenRod' => '#DAA520', | |
'PaleVioletRed' => '#DB7093', | |
'Gainsboro' => '#DCDCDC', | |
'BurlyWood' => '#DEB887', | |
'LightCyan' => '#E0FFFF', | |
'Lavender' => '#E6E6FA', | |
'DarkSalmon' => '#E9967A', | |
'PaleGoldenRod' => '#EEE8AA', | |
'LightCoral' => '#F08080', | |
'AliceBlue' => '#F0F8FF', | |
'Honeydew' => '#F0FFF0', | |
'SandyBrown' => '#F4A460', | |
'WhiteSmoke' => '#F5F5F5', | |
'MintCream' => '#F5FFFA', | |
'GhostWhite' => '#F8F8FF', | |
'AntiqueWhite' => '#FAEBD7', | |
'LightGoldenRodYellow' => '#FAFAD2', | |
'Magenta' => '#F0F', | |
'Fuchsia' => '#F0F', | |
'DeepPink' => '#FF1493', | |
'OrangeRed' => '#FF4500', | |
'DarkOrange' => '#FF8C00', | |
'LightSalmon' => '#FFA07A', | |
'LightPink' => '#FFB6C1', | |
'PeachPuff' => '#FFDAB9', | |
'NavajoWhite' => '#FFDEAD', | |
'Moccasin' => '#FFE4B5', | |
'MistyRose' => '#FFE4E1', | |
'BlanchedAlmond' => '#FFEBCD', | |
'PapayaWhip' => '#FFEFD5', | |
'LavenderBlush' => '#FFF0F5', | |
'SeaShell' => '#FFF5EE', | |
'CornSilk' => '#FFF8DC', | |
'LemonChiffon' => '#FFFACD', | |
'FloralWhite' => '#FFFAF0', | |
'Yellow' => '#FF0', | |
'LightYellow' => '#FFFFE0', | |
'White' => '#FFF', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This array can be used to replace colour names in your CSS with their corresponding hex values, where the latter is shorter. In the case of the hex, I've reduced this too a minimum size.