//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#import "KnownColors.h"

@implementation KnownColors

NSString* AliceBlue = @"#FFF0F8FF";
NSString* AntiqueWhite = @"#FFFAEBD7";
NSString* Aqua = @"#FF00FFFF";
NSString* Aquamarine = @"#FF7FFFD4";
NSString* Azure = @"#FFF0FFFF";
NSString* Beige = @"#FFF5F5DC";
NSString* Bisque = @"#FFFFE4C4";
NSString* Black = @"#FF000000";
NSString* BlanchedAlmond = @"#FFFFEBCD";
NSString* Blue = @"#FF0000FF";
NSString* BlueViolet = @"#FF8A2BE2";
NSString* Brown = @"#FFA52A2A";
NSString* BurlyWood = @"#FFDEB887";
NSString* CadetBlue = @"#FF5F9EA0";
NSString* Chartreuse = @"#FF7FFF00";
NSString* Chocolate = @"#FFD2691E";
NSString* Coral = @"#FFFF7F50";
NSString* CornflowerBlue = @"#FF6495ED";
NSString* Cornsilk = @"#FFFFF8DC";
NSString* Crimson = @"#FFDC143C";
NSString* Cyan = @"#FF00FFFF";
NSString* DarkBlue = @"#FF00008B";
NSString* DarkCyan = @"#FF008B8B";
NSString* DarkGoldenrod = @"#FFB8860B";
NSString* DarkGray = @"#FFA9A9A9";
NSString* DarkGreen = @"#FF006400";
NSString* DarkKhaki = @"#FFBDB76B";
NSString* DarkMagenta = @"#FF8B008B";
NSString* DarkOliveGreen = @"#FF556B2F";
NSString* DarkOrange = @"#FFFF8C00";
NSString* DarkOrchid = @"#FF9932CC";
NSString* DarkRed = @"#FF8B0000";
NSString* DarkSalmon = @"#FFE9967A";
NSString* DarkSeaGreen = @"#FF8FBC8F";
NSString* DarkSlateBlue = @"#FF483D8B";
NSString* DarkSlateGray = @"#FF2F4F4F";
NSString* DarkTurquoise = @"#FF00CED1";
NSString* DarkViolet = @"#FF9400D3";
NSString* DeepPink = @"#FFFF1493";
NSString* DeepSkyBlue = @"#FF00BFFF";
NSString* DimGray = @"#FF696969";
NSString* DodgerBlue = @"#FF1E90FF";
NSString* Firebrick = @"#FFB22222";
NSString* FloralWhite = @"#FFFFFAF0";
NSString* ForestGreen = @"#FF228B22";
NSString* Fuchsia = @"#FFFF00FF";
NSString* Gainsboro = @"#FFDCDCDC";
NSString* GhostWhite = @"#FFF8F8FF";
NSString* Gold = @"#FFFFD700";
NSString* Goldenrod = @"#FFDAA520";
NSString* Gray = @"#FF808080";
NSString* Green = @"#FF008000";
NSString* GreenYellow = @"#FFADFF2F";
NSString* Honeydew = @"#FFF0FFF0";
NSString* HotPink = @"#FFFF69B4";
NSString* IndianRed = @"#FFCD5C5C";
NSString* Indigo = @"#FF4B0082";
NSString* Ivory = @"#FFFFFFF0";
NSString* Khaki = @"#FFF0E68C";
NSString* Lavender = @"#FFE6E6FA";
NSString* LavenderBlush = @"#FFFFF0F5";
NSString* LawnGreen = @"#FF7CFC00";
NSString* LemonChiffon = @"#FFFFFACD";
NSString* LightBlue = @"#FFADD8E6";
NSString* LightCoral = @"#FFF08080";
NSString* LightCyan = @"#FFE0FFFF";
NSString* LightGoldenrodYellow = @"#FFFAFAD2";
NSString* LightGreen = @"#FF90EE90";
NSString* LightGray = @"#FFD3D3D3";
NSString* LightPink = @"#FFFFB6C1";
NSString* LightSalmon = @"#FFFFA07A";
NSString* LightSeaGreen = @"#FF20B2AA";
NSString* LightSkyBlue = @"#FF87CEFA";
NSString* LightSlateGray = @"#FF778899";
NSString* LightSteelBlue = @"#FFB0C4DE";
NSString* LightYellow = @"#FFFFFFE0";
NSString* Lime = @"#FF00FF00";
NSString* LimeGreen = @"#FF32CD32";
NSString* Linen = @"#FFFAF0E6";
NSString* Magenta = @"#FFFF00FF";
NSString* Maroon = @"#FF800000";
NSString* MediumAquamarine = @"#FF66CDAA";
NSString* MediumBlue = @"#FF0000CD";
NSString* MediumOrchid = @"#FFBA55D3";
NSString* MediumPurple = @"#FF9370DB";
NSString* MediumSeaGreen = @"#FF3CB371";
NSString* MediumSlateBlue = @"#FF7B68EE";
NSString* MediumSpringGreen = @"#FF00FA9A";
NSString* MediumTurquoise = @"#FF48D1CC";
NSString* MediumVioletRed = @"#FFC71585";
NSString* MidnightBlue = @"#FF191970";
NSString* MintCream = @"#FFF5FFFA";
NSString* MistyRose = @"#FFFFE4E1";
NSString* Moccasin = @"#FFFFE4B5";
NSString* NavajoWhite = @"#FFFFDEAD";
NSString* Navy = @"#FF000080";
NSString* OldLace = @"#FFFDF5E6";
NSString* Olive = @"#FF808000";
NSString* OliveDrab = @"#FF6B8E23";
NSString* Orange = @"#FFFFA500";
NSString* OrangeRed = @"#FFFF4500";
NSString* Orchid = @"#FFDA70D6";
NSString* PaleGoldenrod = @"#FFEEE8AA";
NSString* PaleGreen = @"#FF98FB98";
NSString* PaleTurquoise = @"#FFAFEEEE";
NSString* PaleVioletRed = @"#FFDB7093";
NSString* PapayaWhip = @"#FFFFEFD5";
NSString* PeachPuff = @"#FFFFDAB9";
NSString* Peru = @"#FFCD853F";
NSString* Pink = @"#FFFFC0CB";
NSString* Plum = @"#FFDDA0DD";
NSString* PowderBlue = @"#FFB0E0E6";
NSString* Purple = @"#FF800080";
NSString* Red = @"#FFFF0000";
NSString* RosyBrown = @"#FFBC8F8F";
NSString* RoyalBlue = @"#FF4169E1";
NSString* SaddleBrown = @"#FF8B4513";
NSString* Salmon = @"#FFFA8072";
NSString* SandyBrown = @"#FFF4A460";
NSString* SeaGreen = @"#FF2E8B57";
NSString* SeaShell = @"#FFFFF5EE";
NSString* Sienna = @"#FFA0522D";
NSString* Silver = @"#FFC0C0C0";
NSString* SkyBlue = @"#FF87CEEB";
NSString* SlateBlue = @"#FF6A5ACD";
NSString* SlateGray = @"#FF708090";
NSString* Snow = @"#FFFFFAFA";
NSString* SpringGreen = @"#FF00FF7F";
NSString* SteelBlue = @"#FF4682B4";
NSString* Tan = @"#FFD2B48C";
NSString* Teal = @"#FF008080";
NSString* Thistle = @"#FFD8BFD8";
NSString* Tomato = @"#FFFF6347";
NSString* Transparent = @"#00FFFFFF";
NSString* Turquoise = @"#FF40E0D0";
NSString* Violet = @"#FFEE82EE";
NSString* Wheat = @"#FFF5DEB3";
NSString* White = @"#FFFFFFFF";
NSString* WhiteSmoke = @"#FFF5F5F5";
NSString* Yellow = @"#FFFFFF00";
NSString* YellowGreen = @"#FF9ACD32";
NSString* UnknownColor = @"#00000001";

+ (NSString*) MatchColor:(NSString*) colorString isKnownColor:(bool*) isKnownColor isNumericColor:(bool*) isNumericColor isContextColor:(bool*) isContextColor isScRgbColor:(bool*) isScRgbColor {
    NSString* trimmedString = [colorString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceCharacterSet]];

    if ((([trimmedString length] == 4) ||
            ([trimmedString length] == 5) ||
            ([trimmedString length] == 7) ||
            ([trimmedString length] == 9)) &&
            ([trimmedString characterAtIndex:0] == '#'))
    {
        *isNumericColor = true;
        *isScRgbColor = false;
        *isKnownColor = false;
        *isContextColor = false;
        return trimmedString;
    }

    *isNumericColor = false;
    *isScRgbColor = false;
    *isContextColor = false;
    *isKnownColor = true;

    return trimmedString;
}

+ (NSString*) ColorStringToKnownColor:(NSString*) colorString {
    if (colorString == nil)
        throw @"Null color string";

    NSString* colorUpper = [colorString uppercaseString];

    switch ([colorUpper length]) {
        case 3:
            if ([colorUpper compare:@"RED"] == 0) return Red;
            if ([colorUpper compare:@"TAN"] == 0) return Tan;
            break;
        case 4:
            switch ([colorUpper characterAtIndex:0]) {
                case 'A':
                    if ([colorUpper compare:@"AQUA"] == 0) return Aqua;
                    break;
                case 'B':
                    if ([colorUpper compare:@"BLUE"] == 0) return Blue;
                    break;
                case 'C':
                    if ([colorUpper compare:@"CYAN"] == 0) return Cyan;
                    break;
                case 'G':
                    if ([colorUpper compare:@"GOLD"] == 0) return Gold;
                    if ([colorUpper compare:@"GRAY"] == 0) return Gray;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LIME"] == 0) return Lime;
                    break;
                case 'N':
                    if ([colorUpper compare:@"NAVY"] == 0) return Navy;
                    break;
                case 'P':
                    if ([colorUpper compare:@"PERU"] == 0) return Peru;
                    if ([colorUpper compare:@"PINK"] == 0) return Pink;
                    if ([colorUpper compare:@"PLUM"] == 0) return Plum;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SNOW"] == 0) return Snow;
                    break;
                case 'T':
                    if ([colorUpper compare:@"TEAL"] == 0) return Teal;
                    break;
            }
            break;
        case 5:
            switch ([colorUpper characterAtIndex:0]) {
                case 'A':
                    if ([colorUpper compare:@"AZURE"] == 0) return Azure;
                    break;
                case 'B':
                    if ([colorUpper compare:@"BEIGE"] == 0) return Beige;
                    if ([colorUpper compare:@"BLACK"] == 0) return Black;
                    if ([colorUpper compare:@"BROWN"] == 0) return Brown;
                    break;
                case 'C':
                    if ([colorUpper compare:@"CORAL"] == 0) return Coral;
                    break;
                case 'G':
                    if ([colorUpper compare:@"GREEN"] == 0) return Green;
                    break;
                case 'I':
                    if ([colorUpper compare:@"IVORY"] == 0) return Ivory;
                    break;
                case 'K':
                    if ([colorUpper compare:@"KHAKI"] == 0) return Khaki;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LINEN"] == 0) return Linen;
                    break;
                case 'O':
                    if ([colorUpper compare:@"OLIVE"] == 0) return Olive;
                    break;
                case 'W':
                    if ([colorUpper compare:@"WHEAT"] == 0) return Wheat;
                    if ([colorUpper compare:@"WHITE"] == 0) return White;
                    break;
            }
            break;
        case 6:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'B':
                    if ([colorUpper compare:@"BISQUE"] == 0) return Bisque;
                    break;
                case 'I':
                    if ([colorUpper compare:@"INDIGO"] == 0) return Indigo;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MAROON"] == 0) return Maroon;
                    break;
                case 'O':
                    if ([colorUpper compare:@"ORANGE"] == 0) return Orange;
                    if ([colorUpper compare:@"ORCHID"] == 0) return Orchid;
                    break;
                case 'P':
                    if ([colorUpper compare:@"PURPLE"] == 0) return Purple;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SALMON"] == 0) return Salmon;
                    if ([colorUpper compare:@"SIENNA"] == 0) return Sienna;
                    if ([colorUpper compare:@"SILVER"] == 0) return Silver;
                    break;
                case 'T':
                    if ([colorUpper compare:@"TOMATO"] == 0) return Tomato;
                    break;
                case 'V':
                    if ([colorUpper compare:@"VIOLET"] == 0) return Violet;
                    break;
                case 'Y':
                    if ([colorUpper compare:@"YELLOW"] == 0) return Yellow;
                    break;
            }
            break;
        case 7:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'C':
                    if ([colorUpper compare:@"CRIMSON"] == 0) return Crimson;
                    break;
                case 'D':
                    if ([colorUpper compare:@"DARKRED"] == 0) return DarkRed;
                    if ([colorUpper compare:@"DIMGRAY"] == 0) return DimGray;
                    break;
                case 'F':
                    if ([colorUpper compare:@"FUCHSIA"] == 0) return Fuchsia;
                    break;
                case 'H':
                    if ([colorUpper compare:@"HOTPINK"] == 0) return HotPink;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MAGENTA"] == 0) return Magenta;
                    break;
                case 'O':
                    if ([colorUpper compare:@"OLDLACE"] == 0) return OldLace;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SKYBLUE"] == 0) return SkyBlue;
                    break;
                case 'T':
                    if ([colorUpper compare:@"THISTLE"] == 0) return Thistle;
                    break;
            }
            break;
        case 8:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'C':
                    if ([colorUpper compare:@"CORNSILK"] == 0) return Cornsilk;
                    break;
                case 'D':
                    if ([colorUpper compare:@"DARKBLUE"] == 0) return DarkBlue;
                    if ([colorUpper compare:@"DARKCYAN"] == 0) return DarkCyan;
                    if ([colorUpper compare:@"DARKGRAY"] == 0) return DarkGray;
                    if ([colorUpper compare:@"DEEPPINK"] == 0) return DeepPink;
                    break;
                case 'H':
                    if ([colorUpper compare:@"HONEYDEW"] == 0) return Honeydew;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LAVENDER"] == 0) return Lavender;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MOCCASIN"] == 0) return Moccasin;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SEAGREEN"] == 0) return SeaGreen;
                    if ([colorUpper compare:@"SEASHELL"] == 0) return SeaShell;
                    break;
            }
            break;
        case 9:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'A':
                    if ([colorUpper compare:@"ALICEBLUE"] == 0) return AliceBlue;
                    break;
                case 'B':
                    if ([colorUpper compare:@"BURLYWOOD"] == 0) return BurlyWood;
                    break;
                case 'C':
                    if ([colorUpper compare:@"CADETBLUE"] == 0) return CadetBlue;
                    if ([colorUpper compare:@"CHOCOLATE"] == 0) return Chocolate;
                    break;
                case 'D':
                    if ([colorUpper compare:@"DARKGREEN"] == 0) return DarkGreen;
                    if ([colorUpper compare:@"DARKKHAKI"] == 0) return DarkKhaki;
                    break;
                case 'F':
                    if ([colorUpper compare:@"FIREBRICK"] == 0) return Firebrick;
                    break;
                case 'G':
                    if ([colorUpper compare:@"GAINSBORO"] == 0) return Gainsboro;
                    if ([colorUpper compare:@"GOLDENROD"] == 0) return Goldenrod;
                    break;
                case 'I':
                    if ([colorUpper compare:@"INDIANRED"] == 0) return IndianRed;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LAWNGREEN"] == 0) return LawnGreen;
                    if ([colorUpper compare:@"LIGHTBLUE"] == 0) return LightBlue;
                    if ([colorUpper compare:@"LIGHTCYAN"] == 0) return LightCyan;
                    if ([colorUpper compare:@"LIGHTGRAY"] == 0) return LightGray;
                    if ([colorUpper compare:@"LIGHTPINK"] == 0) return LightPink;
                    if ([colorUpper compare:@"LIMEGREEN"] == 0) return LimeGreen;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MINTCREAM"] == 0) return MintCream;
                    if ([colorUpper compare:@"MISTYROSE"] == 0) return MistyRose;
                    break;
                case 'O':
                    if ([colorUpper compare:@"OLIVEDRAB"] == 0) return OliveDrab;
                    if ([colorUpper compare:@"ORANGERED"] == 0) return OrangeRed;
                    break;
                case 'P':
                    if ([colorUpper compare:@"PALEGREEN"] == 0) return PaleGreen;
                    if ([colorUpper compare:@"PEACHPUFF"] == 0) return PeachPuff;
                    break;
                case 'R':
                    if ([colorUpper compare:@"ROSYBROWN"] == 0) return RosyBrown;
                    if ([colorUpper compare:@"ROYALBLUE"] == 0) return RoyalBlue;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SLATEBLUE"] == 0) return SlateBlue;
                    if ([colorUpper compare:@"SLATEGRAY"] == 0) return SlateGray;
                    if ([colorUpper compare:@"STEELBLUE"] == 0) return SteelBlue;
                    break;
                case 'T':
                    if ([colorUpper compare:@"TURQUOISE"] == 0) return Turquoise;
                    break;
            }
            break;
        case 10:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'A':
                    if ([colorUpper compare:@"AQUAMARINE"] == 0) return Aquamarine;
                    break;
                case 'B':
                    if ([colorUpper compare:@"BLUEVIOLET"] == 0) return BlueViolet;
                    break;
                case 'C':
                    if ([colorUpper compare:@"CHARTREUSE"] == 0) return Chartreuse;
                    break;
                case 'D':
                    if ([colorUpper compare:@"DARKORANGE"] == 0) return DarkOrange;
                    if ([colorUpper compare:@"DARKORCHID"] == 0) return DarkOrchid;
                    if ([colorUpper compare:@"DARKSALMON"] == 0) return DarkSalmon;
                    if ([colorUpper compare:@"DARKVIOLET"] == 0) return DarkViolet;
                    if ([colorUpper compare:@"DODGERBLUE"] == 0) return DodgerBlue;
                    break;
                case 'G':
                    if ([colorUpper compare:@"GHOSTWHITE"] == 0) return GhostWhite;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LIGHTCORAL"] == 0) return LightCoral;
                    if ([colorUpper compare:@"LIGHTGREEN"] == 0) return LightGreen;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MEDIUMBLUE"] == 0) return MediumBlue;
                    break;
                case 'P':
                    if ([colorUpper compare:@"PAPAYAWHIP"] == 0) return PapayaWhip;
                    if ([colorUpper compare:@"POWDERBLUE"] == 0) return PowderBlue;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SANDYBROWN"] == 0) return SandyBrown;
                    break;
                case 'W':
                    if ([colorUpper compare:@"WHITESMOKE"] == 0) return WhiteSmoke;
                    break;
            }
            break;
        case 11:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'D':
                    if ([colorUpper compare:@"DARKMAGENTA"] == 0) return DarkMagenta;
                    if ([colorUpper compare:@"DEEPSKYBLUE"] == 0) return DeepSkyBlue;
                    break;
                case 'F':
                    if ([colorUpper compare:@"FLORALWHITE"] == 0) return FloralWhite;
                    if ([colorUpper compare:@"FORESTGREEN"] == 0) return ForestGreen;
                    break;
                case 'G':
                    if ([colorUpper compare:@"GREENYELLOW"] == 0) return GreenYellow;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LIGHTSALMON"] == 0) return LightSalmon;
                    if ([colorUpper compare:@"LIGHTYELLOW"] == 0) return LightYellow;
                    break;
                case 'N':
                    if ([colorUpper compare:@"NAVAJOWHITE"] == 0) return NavajoWhite;
                    break;
                case 'S':
                    if ([colorUpper compare:@"SADDLEBROWN"] == 0) return SaddleBrown;
                    if ([colorUpper compare:@"SPRINGGREEN"] == 0) return SpringGreen;
                    break;
                case 'T':
                    if ([colorUpper compare:@"TRANSPARENT"] == 0) return Transparent;
                    break;
                case 'Y':
                    if ([colorUpper compare:@"YELLOWGREEN"] == 0) return YellowGreen;
                    break;
            }
            break;
        case 12:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'A':
                    if ([colorUpper compare:@"ANTIQUEWHITE"] == 0) return AntiqueWhite;
                    break;
                case 'D':
                    if ([colorUpper compare:@"DARKSEAGREEN"] == 0) return DarkSeaGreen;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LIGHTSKYBLUE"] == 0) return LightSkyBlue;
                    if ([colorUpper compare:@"LEMONCHIFFON"] == 0) return LemonChiffon;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MEDIUMORCHID"] == 0) return MediumOrchid;
                    if ([colorUpper compare:@"MEDIUMPURPLE"] == 0) return MediumPurple;
                    if ([colorUpper compare:@"MIDNIGHTBLUE"] == 0) return MidnightBlue;
                    break;
            }
            break;
        case 13:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'D':
                    if ([colorUpper compare:@"DARKSLATEBLUE"] == 0) return DarkSlateBlue;
                    if ([colorUpper compare:@"DARKSLATEGRAY"] == 0) return DarkSlateGray;
                    if ([colorUpper compare:@"DARKGOLDENROD"] == 0) return DarkGoldenrod;
                    if ([colorUpper compare:@"DARKTURQUOISE"] == 0) return DarkTurquoise;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LIGHTSEAGREEN"] == 0) return LightSeaGreen;
                    if ([colorUpper compare:@"LAVENDERBLUSH"] == 0) return LavenderBlush;
                    break;
                case 'P':
                    if ([colorUpper compare:@"PALEGOLDENROD"] == 0) return PaleGoldenrod;
                    if ([colorUpper compare:@"PALETURQUOISE"] == 0) return PaleTurquoise;
                    if ([colorUpper compare:@"PALEVIOLETRED"] == 0) return PaleVioletRed;
                    break;
            }
            break;
        case 14:
            switch ([colorUpper characterAtIndex:0])
            {
                case 'B':
                    if ([colorUpper compare:@"BLANCHEDALMOND"] == 0) return BlanchedAlmond;
                    break;
                case 'C':
                    if ([colorUpper compare:@"CORNFLOWERBLUE"] == 0) return CornflowerBlue;
                    break;
                case 'D':
                    if ([colorUpper compare:@"DARKOLIVEGREEN"] == 0) return DarkOliveGreen;
                    break;
                case 'L':
                    if ([colorUpper compare:@"LIGHTSLATEGRAY"] == 0) return LightSlateGray;
                    if ([colorUpper compare:@"LIGHTSTEELBLUE"] == 0) return LightSteelBlue;
                    break;
                case 'M':
                    if ([colorUpper compare:@"MEDIUMSEAGREEN"] == 0) return MediumSeaGreen;
                    break;
            }
            break;
        case 15:
            if ([colorUpper compare:@"MEDIUMSLATEBLUE"] == 0) return MediumSlateBlue;
            if ([colorUpper compare:@"MEDIUMTURQUOISE"] == 0) return MediumTurquoise;
            if ([colorUpper compare:@"MEDIUMVIOLETRED"] == 0) return MediumVioletRed;
            break;
        case 16:
            if ([colorUpper compare:@"MEDIUMAQUAMARINE"] == 0) return MediumAquamarine;
            break;
        case 17:
            if ([colorUpper compare:@"MEDIUMSPRINGGREEN"] == 0) return MediumSpringGreen;
            break;
        case 20:
            if ([colorUpper compare:@"LIGHTGOLDENRODYELLOW"] == 0) return LightGoldenrodYellow;
            break;
    }

    throw [NSString stringWithFormat:@"Unknown color %@", colorString];
}

@end
