Module DrawingPanel :: Class Color

Class Color

A class to deal with colors. A color can be specified in four ways by the client: 1) as a Color constant like Color.RED or Color.LIGHT_SKY_BLUE 2) as a name like "red" or "light sky blue" 3) as a six-character hex string like "#ff00cc" 4) as a three-integer tuple like (255, 0, 198) where each int is in range 0-255

Instance Methods
 
__init__(self, *args)
Constructs a color.
 
__str__(self)
Returns a string representation of this color.
Static Methods
 
is_valid_color(color)
Returns True if the color passed is a valid color in any form, such as a Color object, a hex string such as "#ff00cc", a color name such as "red" or "light sky blue", or RGB color expressed as a 3-element tuple or list.
 
is_hex(color)
Returns True if the color passed is a valid hex color string such as "#ff00cc".
 
is_name(color)
Returns True if the color passed is a valid color name such as "red" or "light sky blue".
 
is_rgb(color)
Returns True if the color passed is a valid RGB color expressed as a 3-element tuple or list.
 
to_hex(*args)
Converts a color into a hex color string such as "#ff00ff".
 
to_name(*args)
Converts a color into a color name string such as "red" or "light sky blue".
 
to_rgb(*args)
Converts a color into an RGB tuple such as (255, 0, 128).
 
normalize_all_colors(options)
Makes sure that any color values in the given dict are in normalized hex string form, not tuples or color names.
Class Variables
  ALICE_BLUE = 'alice blue'
  ALICEBLUE = 'AliceBlue'
  ANTIQUE_WHITE = 'antique white'
  ANTIQUEWHITE = 'AntiqueWhite'
  ANTIQUEWHITE1 = 'AntiqueWhite1'
  ANTIQUEWHITE2 = 'AntiqueWhite2'
  ANTIQUEWHITE3 = 'AntiqueWhite3'
  ANTIQUEWHITE4 = 'AntiqueWhite4'
  AQUAMARINE = 'aquamarine'
  AQUAMARINE1 = 'aquamarine1'
  AQUAMARINE2 = 'aquamarine2'
  AQUAMARINE3 = 'aquamarine3'
  AQUAMARINE4 = 'aquamarine4'
  AZURE = 'azure'
  AZURE1 = 'azure1'
  AZURE2 = 'azure2'
  AZURE3 = 'azure3'
  AZURE4 = 'azure4'
  BEIGE = 'beige'
  BISQUE = 'bisque'
  BISQUE1 = 'bisque1'
  BISQUE2 = 'bisque2'
  BISQUE3 = 'bisque3'
  BISQUE4 = 'bisque4'
  BLACK = 'black'
  BLANCHED_ALMOND = 'blanched almond'
  BLANCHEDALMOND = 'BlanchedAlmond'
  BLUE = 'blue'
  BLUE_VIOLET = 'blue violet'
  BLUE1 = 'blue1'
  BLUE2 = 'blue2'
  BLUE3 = 'blue3'
  BLUE4 = 'blue4'
  BLUEVIOLET = 'BlueViolet'
  BROWN = 'brown'
  BROWN1 = 'brown1'
  BROWN2 = 'brown2'
  BROWN3 = 'brown3'
  BROWN4 = 'brown4'
  BURLYWOOD = 'burlywood'
  BURLYWOOD1 = 'burlywood1'
  BURLYWOOD2 = 'burlywood2'
  BURLYWOOD3 = 'burlywood3'
  BURLYWOOD4 = 'burlywood4'
  CADET_BLUE = 'cadet blue'
  CADETBLUE = 'CadetBlue'
  CADETBLUE1 = 'CadetBlue1'
  CADETBLUE2 = 'CadetBlue2'
  CADETBLUE3 = 'CadetBlue3'
  CADETBLUE4 = 'CadetBlue4'
  CHARTREUSE = 'chartreuse'
  CHARTREUSE1 = 'chartreuse1'
  CHARTREUSE2 = 'chartreuse2'
  CHARTREUSE3 = 'chartreuse3'
  CHARTREUSE4 = 'chartreuse4'
  CHOCOLATE = 'chocolate'
  CHOCOLATE1 = 'chocolate1'
  CHOCOLATE2 = 'chocolate2'
  CHOCOLATE3 = 'chocolate3'
  CHOCOLATE4 = 'chocolate4'
  CORAL = 'coral'
  CORAL1 = 'coral1'
  CORAL2 = 'coral2'
  CORAL3 = 'coral3'
  CORAL4 = 'coral4'
  CORNFLOWER_BLUE = 'cornflower blue'
  CORNFLOWERBLUE = 'CornflowerBlue'
  CORNSILK = 'cornsilk'
  CORNSILK1 = 'cornsilk1'
  CORNSILK2 = 'cornsilk2'
  CORNSILK3 = 'cornsilk3'
  CORNSILK4 = 'cornsilk4'
  CYAN = 'cyan'
  CYAN1 = 'cyan1'
  CYAN2 = 'cyan2'
  CYAN3 = 'cyan3'
  CYAN4 = 'cyan4'
  DARK_BLUE = 'dark blue'
  DARK_CYAN = 'dark cyan'
  DARK_GOLDENROD = 'dark goldenrod'
  DARK_GRAY = 'dark gray'
  DARK_GREEN = 'dark green'
  DARK_GREY = 'dark grey'
  DARK_KHAKI = 'dark khaki'
  DARK_MAGENTA = 'dark magenta'
  DARK_OLIVE_GREEN = 'dark olive green'
  DARK_ORANGE = 'dark orange'
  DARK_ORCHID = 'dark orchid'
  DARK_RED = 'dark red'
  DARK_SALMON = 'dark salmon'
  DARK_SEA_GREEN = 'dark sea green'
  DARK_SLATE_BLUE = 'dark slate blue'
  DARK_SLATE_GRAY = 'dark slate gray'
  DARK_SLATE_GREY = 'dark slate grey'
  DARK_TURQUOISE = 'dark turquoise'
  DARK_VIOLET = 'dark violet'
  DARKBLUE = 'DarkBlue'
  DARKCYAN = 'DarkCyan'
  DARKGOLDENROD = 'DarkGoldenrod'
  DARKGOLDENROD1 = 'DarkGoldenrod1'
  DARKGOLDENROD2 = 'DarkGoldenrod2'
  DARKGOLDENROD3 = 'DarkGoldenrod3'
  DARKGOLDENROD4 = 'DarkGoldenrod4'
  DARKGRAY = 'DarkGray'
  DARKGREEN = 'DarkGreen'
  DARKGREY = 'DarkGrey'
  DARKKHAKI = 'DarkKhaki'
  DARKMAGENTA = 'DarkMagenta'
  DARKOLIVEGREEN = 'DarkOliveGreen'
  DARKOLIVEGREEN1 = 'DarkOliveGreen1'
  DARKOLIVEGREEN2 = 'DarkOliveGreen2'
  DARKOLIVEGREEN3 = 'DarkOliveGreen3'
  DARKOLIVEGREEN4 = 'DarkOliveGreen4'
  DARKORANGE = 'DarkOrange'
  DARKORANGE1 = 'DarkOrange1'
  DARKORANGE2 = 'DarkOrange2'
  DARKORANGE3 = 'DarkOrange3'
  DARKORANGE4 = 'DarkOrange4'
  DARKORCHID = 'DarkOrchid'
  DARKORCHID1 = 'DarkOrchid1'
  DARKORCHID2 = 'DarkOrchid2'
  DARKORCHID3 = 'DarkOrchid3'
  DARKORCHID4 = 'DarkOrchid4'
  DARKRED = 'DarkRed'
  DARKSALMON = 'DarkSalmon'
  DARKSEAGREEN = 'DarkSeaGreen'
  DARKSEAGREEN1 = 'DarkSeaGreen1'
  DARKSEAGREEN2 = 'DarkSeaGreen2'
  DARKSEAGREEN3 = 'DarkSeaGreen3'
  DARKSEAGREEN4 = 'DarkSeaGreen4'
  DARKSLATEBLUE = 'DarkSlateBlue'
  DARKSLATEGRAY = 'DarkSlateGray'
  DARKSLATEGRAY1 = 'DarkSlateGray1'
  DARKSLATEGRAY2 = 'DarkSlateGray2'
  DARKSLATEGRAY3 = 'DarkSlateGray3'
  DARKSLATEGRAY4 = 'DarkSlateGray4'
  DARKSLATEGREY = 'DarkSlateGrey'
  DARKTURQUOISE = 'DarkTurquoise'
  DARKVIOLET = 'DarkViolet'
  DEEP_PINK = 'deep pink'
  DEEP_SKY_BLUE = 'deep sky blue'
  DEEPPINK = 'DeepPink'
  DEEPPINK1 = 'DeepPink1'
  DEEPPINK2 = 'DeepPink2'
  DEEPPINK3 = 'DeepPink3'
  DEEPPINK4 = 'DeepPink4'
  DEEPSKYBLUE = 'DeepSkyBlue'
  DEEPSKYBLUE1 = 'DeepSkyBlue1'
  DEEPSKYBLUE2 = 'DeepSkyBlue2'
  DEEPSKYBLUE3 = 'DeepSkyBlue3'
  DEEPSKYBLUE4 = 'DeepSkyBlue4'
  DIM_GRAY = 'dim gray'
  DIM_GREY = 'dim grey'
  DIMGRAY = 'DimGray'
  DIMGREY = 'DimGrey'
  DODGER_BLUE = 'dodger blue'
  DODGERBLUE = 'DodgerBlue'
  DODGERBLUE1 = 'DodgerBlue1'
  DODGERBLUE2 = 'DodgerBlue2'
  DODGERBLUE3 = 'DodgerBlue3'
  DODGERBLUE4 = 'DodgerBlue4'
  FIREBRICK = 'firebrick'
  FIREBRICK1 = 'firebrick1'
  FIREBRICK2 = 'firebrick2'
  FIREBRICK3 = 'firebrick3'
  FIREBRICK4 = 'firebrick4'
  FLORAL_WHITE = 'floral white'
  FLORALWHITE = 'FloralWhite'
  FOREST_GREEN = 'forest green'
  FORESTGREEN = 'ForestGreen'
  GAINSBORO = 'gainsboro'
  GHOST_WHITE = 'ghost white'
  GHOSTWHITE = 'GhostWhite'
  GOLD = 'gold'
  GOLD1 = 'gold1'
  GOLD2 = 'gold2'
  GOLD3 = 'gold3'
  GOLD4 = 'gold4'
  GOLDENROD = 'goldenrod'
  GOLDENROD1 = 'goldenrod1'
  GOLDENROD2 = 'goldenrod2'
  GOLDENROD3 = 'goldenrod3'
  GOLDENROD4 = 'goldenrod4'
  GRAY = 'gray'
  GRAY0 = 'gray0'
  GRAY1 = 'gray1'
  GRAY2 = 'gray2'
  GRAY3 = 'gray3'
  GRAY4 = 'gray4'
  GRAY5 = 'gray5'
  GRAY6 = 'gray6'
  GRAY7 = 'gray7'
  GRAY8 = 'gray8'
  GRAY9 = 'gray9'
  GRAY10 = 'gray10'
  GRAY11 = 'gray11'
  GRAY12 = 'gray12'
  GRAY13 = 'gray13'
  GRAY14 = 'gray14'
  GRAY15 = 'gray15'
  GRAY16 = 'gray16'
  GRAY17 = 'gray17'
  GRAY18 = 'gray18'
  GRAY19 = 'gray19'
  GRAY20 = 'gray20'
  GRAY21 = 'gray21'
  GRAY22 = 'gray22'
  GRAY23 = 'gray23'
  GRAY24 = 'gray24'
  GRAY25 = 'gray25'
  GRAY26 = 'gray26'
  GRAY27 = 'gray27'
  GRAY28 = 'gray28'
  GRAY29 = 'gray29'
  GRAY30 = 'gray30'
  GRAY31 = 'gray31'
  GRAY32 = 'gray32'
  GRAY33 = 'gray33'
  GRAY34 = 'gray34'
  GRAY35 = 'gray35'
  GRAY36 = 'gray36'
  GRAY37 = 'gray37'
  GRAY38 = 'gray38'
  GRAY39 = 'gray39'
  GRAY40 = 'gray40'
  GRAY41 = 'gray41'
  GRAY42 = 'gray42'
  GRAY43 = 'gray43'
  GRAY44 = 'gray44'
  GRAY45 = 'gray45'
  GRAY46 = 'gray46'
  GRAY47 = 'gray47'
  GRAY48 = 'gray48'
  GRAY49 = 'gray49'
  GRAY50 = 'gray50'
  GRAY51 = 'gray51'
  GRAY52 = 'gray52'
  GRAY53 = 'gray53'
  GRAY54 = 'gray54'
  GRAY55 = 'gray55'
  GRAY56 = 'gray56'
  GRAY57 = 'gray57'
  GRAY58 = 'gray58'
  GRAY59 = 'gray59'
  GRAY60 = 'gray60'
  GRAY61 = 'gray61'
  GRAY62 = 'gray62'
  GRAY63 = 'gray63'
  GRAY64 = 'gray64'
  GRAY65 = 'gray65'
  GRAY66 = 'gray66'
  GRAY67 = 'gray67'
  GRAY68 = 'gray68'
  GRAY69 = 'gray69'
  GRAY70 = 'gray70'
  GRAY71 = 'gray71'
  GRAY72 = 'gray72'
  GRAY73 = 'gray73'
  GRAY74 = 'gray74'
  GRAY75 = 'gray75'
  GRAY76 = 'gray76'
  GRAY77 = 'gray77'
  GRAY78 = 'gray78'
  GRAY79 = 'gray79'
  GRAY80 = 'gray80'
  GRAY81 = 'gray81'
  GRAY82 = 'gray82'
  GRAY83 = 'gray83'
  GRAY84 = 'gray84'
  GRAY85 = 'gray85'
  GRAY86 = 'gray86'
  GRAY87 = 'gray87'
  GRAY88 = 'gray88'
  GRAY89 = 'gray89'
  GRAY90 = 'gray90'
  GRAY91 = 'gray91'
  GRAY92 = 'gray92'
  GRAY93 = 'gray93'
  GRAY94 = 'gray94'
  GRAY95 = 'gray95'
  GRAY96 = 'gray96'
  GRAY97 = 'gray97'
  GRAY98 = 'gray98'
  GRAY99 = 'gray99'
  GRAY100 = 'gray100'
  GREEN = 'green'
  GREEN_YELLOW = 'green yellow'
  GREEN1 = 'green1'
  GREEN2 = 'green2'
  GREEN3 = 'green3'
  GREEN4 = 'green4'
  GREENYELLOW = 'GreenYellow'
  GREY = 'grey'
  GREY0 = 'grey0'
  GREY1 = 'grey1'
  GREY2 = 'grey2'
  GREY3 = 'grey3'
  GREY4 = 'grey4'
  GREY5 = 'grey5'
  GREY6 = 'grey6'
  GREY7 = 'grey7'
  GREY8 = 'grey8'
  GREY9 = 'grey9'
  GREY10 = 'grey10'
  GREY11 = 'grey11'
  GREY12 = 'grey12'
  GREY13 = 'grey13'
  GREY14 = 'grey14'
  GREY15 = 'grey15'
  GREY16 = 'grey16'
  GREY17 = 'grey17'
  GREY18 = 'grey18'
  GREY19 = 'grey19'
  GREY20 = 'grey20'
  GREY21 = 'grey21'
  GREY22 = 'grey22'
  GREY23 = 'grey23'
  GREY24 = 'grey24'
  GREY25 = 'grey25'
  GREY26 = 'grey26'
  GREY27 = 'grey27'
  GREY28 = 'grey28'
  GREY29 = 'grey29'
  GREY30 = 'grey30'
  GREY31 = 'grey31'
  GREY32 = 'grey32'
  GREY33 = 'grey33'
  GREY34 = 'grey34'
  GREY35 = 'grey35'
  GREY36 = 'grey36'
  GREY37 = 'grey37'
  GREY38 = 'grey38'
  GREY39 = 'grey39'
  GREY40 = 'grey40'
  GREY41 = 'grey41'
  GREY42 = 'grey42'
  GREY43 = 'grey43'
  GREY44 = 'grey44'
  GREY45 = 'grey45'
  GREY46 = 'grey46'
  GREY47 = 'grey47'
  GREY48 = 'grey48'
  GREY49 = 'grey49'
  GREY50 = 'grey50'
  GREY51 = 'grey51'
  GREY52 = 'grey52'
  GREY53 = 'grey53'
  GREY54 = 'grey54'
  GREY55 = 'grey55'
  GREY56 = 'grey56'
  GREY57 = 'grey57'
  GREY58 = 'grey58'
  GREY59 = 'grey59'
  GREY60 = 'grey60'
  GREY61 = 'grey61'
  GREY62 = 'grey62'
  GREY63 = 'grey63'
  GREY64 = 'grey64'
  GREY65 = 'grey65'
  GREY66 = 'grey66'
  GREY67 = 'grey67'
  GREY68 = 'grey68'
  GREY69 = 'grey69'
  GREY70 = 'grey70'
  GREY71 = 'grey71'
  GREY72 = 'grey72'
  GREY73 = 'grey73'
  GREY74 = 'grey74'
  GREY75 = 'grey75'
  GREY76 = 'grey76'
  GREY77 = 'grey77'
  GREY78 = 'grey78'
  GREY79 = 'grey79'
  GREY80 = 'grey80'
  GREY81 = 'grey81'
  GREY82 = 'grey82'
  GREY83 = 'grey83'
  GREY84 = 'grey84'
  GREY85 = 'grey85'
  GREY86 = 'grey86'
  GREY87 = 'grey87'
  GREY88 = 'grey88'
  GREY89 = 'grey89'
  GREY90 = 'grey90'
  GREY91 = 'grey91'
  GREY92 = 'grey92'
  GREY93 = 'grey93'
  GREY94 = 'grey94'
  GREY95 = 'grey95'
  GREY96 = 'grey96'
  GREY97 = 'grey97'
  GREY98 = 'grey98'
  GREY99 = 'grey99'
  GREY100 = 'grey100'
  HONEYDEW = 'honeydew'
  HONEYDEW1 = 'honeydew1'
  HONEYDEW2 = 'honeydew2'
  HONEYDEW3 = 'honeydew3'
  HONEYDEW4 = 'honeydew4'
  HOT_PINK = 'hot pink'
  HOTPINK = 'HotPink'
  HOTPINK1 = 'HotPink1'
  HOTPINK2 = 'HotPink2'
  HOTPINK3 = 'HotPink3'
  HOTPINK4 = 'HotPink4'
  INDIAN_RED = 'indian red'
  INDIANRED = 'IndianRed'
  INDIANRED1 = 'IndianRed1'
  INDIANRED2 = 'IndianRed2'
  INDIANRED3 = 'IndianRed3'
  INDIANRED4 = 'IndianRed4'
  IVORY = 'ivory'
  IVORY1 = 'ivory1'
  IVORY2 = 'ivory2'
  IVORY3 = 'ivory3'
  IVORY4 = 'ivory4'
  KHAKI = 'khaki'
  KHAKI1 = 'khaki1'
  KHAKI2 = 'khaki2'
  KHAKI3 = 'khaki3'
  KHAKI4 = 'khaki4'
  LAVENDER = 'lavender'
  LAVENDER_BLUSH = 'lavender blush'
  LAVENDERBLUSH = 'LavenderBlush'
  LAVENDERBLUSH1 = 'LavenderBlush1'
  LAVENDERBLUSH2 = 'LavenderBlush2'
  LAVENDERBLUSH3 = 'LavenderBlush3'
  LAVENDERBLUSH4 = 'LavenderBlush4'
  LAWN_GREEN = 'lawn green'
  LAWNGREEN = 'LawnGreen'
  LEMON_CHIFFON = 'lemon chiffon'
  LEMONCHIFFON = 'LemonChiffon'
  LEMONCHIFFON1 = 'LemonChiffon1'
  LEMONCHIFFON2 = 'LemonChiffon2'
  LEMONCHIFFON3 = 'LemonChiffon3'
  LEMONCHIFFON4 = 'LemonChiffon4'
  LIGHT_BLUE = 'light blue'
  LIGHT_CORAL = 'light coral'
  LIGHT_CYAN = 'light cyan'
  LIGHT_GOLDENROD = 'light goldenrod'
  LIGHT_GOLDENROD_YELLOW = 'light goldenrod yellow'
  LIGHT_GRAY = 'light gray'
  LIGHT_GREEN = 'light green'
  LIGHT_GREY = 'light grey'
  LIGHT_PINK = 'light pink'
  LIGHT_SALMON = 'light salmon'
  LIGHT_SEA_GREEN = 'light sea green'
  LIGHT_SKY_BLUE = 'light sky blue'
  LIGHT_SLATE_BLUE = 'light slate blue'
  LIGHT_SLATE_GRAY = 'light slate gray'
  LIGHT_SLATE_GREY = 'light slate grey'
  LIGHT_STEEL_BLUE = 'light steel blue'
  LIGHT_YELLOW = 'light yellow'
  LIGHTBLUE = 'LightBlue'
  LIGHTBLUE1 = 'LightBlue1'
  LIGHTBLUE2 = 'LightBlue2'
  LIGHTBLUE3 = 'LightBlue3'
  LIGHTBLUE4 = 'LightBlue4'
  LIGHTCORAL = 'LightCoral'
  LIGHTCYAN = 'LightCyan'
  LIGHTCYAN1 = 'LightCyan1'
  LIGHTCYAN2 = 'LightCyan2'
  LIGHTCYAN3 = 'LightCyan3'
  LIGHTCYAN4 = 'LightCyan4'
  LIGHTGOLDENROD = 'LightGoldenrod'
  LIGHTGOLDENROD1 = 'LightGoldenrod1'
  LIGHTGOLDENROD2 = 'LightGoldenrod2'
  LIGHTGOLDENROD3 = 'LightGoldenrod3'
  LIGHTGOLDENROD4 = 'LightGoldenrod4'
  LIGHTGOLDENRODYELLOW = 'LightGoldenrodYellow'
  LIGHTGRAY = 'LightGray'
  LIGHTGREEN = 'LightGreen'
  LIGHTGREY = 'LightGrey'
  LIGHTPINK = 'LightPink'
  LIGHTPINK1 = 'LightPink1'
  LIGHTPINK2 = 'LightPink2'
  LIGHTPINK3 = 'LightPink3'
  LIGHTPINK4 = 'LightPink4'
  LIGHTSALMON = 'LightSalmon'
  LIGHTSALMON1 = 'LightSalmon1'
  LIGHTSALMON2 = 'LightSalmon2'
  LIGHTSALMON3 = 'LightSalmon3'
  LIGHTSALMON4 = 'LightSalmon4'
  LIGHTSEAGREEN = 'LightSeaGreen'
  LIGHTSKYBLUE = 'LightSkyBlue'
  LIGHTSKYBLUE1 = 'LightSkyBlue1'
  LIGHTSKYBLUE2 = 'LightSkyBlue2'
  LIGHTSKYBLUE3 = 'LightSkyBlue3'
  LIGHTSKYBLUE4 = 'LightSkyBlue4'
  LIGHTSLATEBLUE = 'LightSlateBlue'
  LIGHTSLATEGRAY = 'LightSlateGray'
  LIGHTSLATEGREY = 'LightSlateGrey'
  LIGHTSTEELBLUE = 'LightSteelBlue'
  LIGHTSTEELBLUE1 = 'LightSteelBlue1'
  LIGHTSTEELBLUE2 = 'LightSteelBlue2'
  LIGHTSTEELBLUE3 = 'LightSteelBlue3'
  LIGHTSTEELBLUE4 = 'LightSteelBlue4'
  LIGHTYELLOW = 'LightYellow'
  LIGHTYELLOW1 = 'LightYellow1'
  LIGHTYELLOW2 = 'LightYellow2'
  LIGHTYELLOW3 = 'LightYellow3'
  LIGHTYELLOW4 = 'LightYellow4'
  LIME_GREEN = 'lime green'
  LIMEGREEN = 'LimeGreen'
  LINEN = 'linen'
  MAGENTA = 'magenta'
  MAGENTA1 = 'magenta1'
  MAGENTA2 = 'magenta2'
  MAGENTA3 = 'magenta3'
  MAGENTA4 = 'magenta4'
  MAROON = 'maroon'
  MAROON1 = 'maroon1'
  MAROON2 = 'maroon2'
  MAROON3 = 'maroon3'
  MAROON4 = 'maroon4'
  MEDIUM_AQUAMARINE = 'medium aquamarine'
  MEDIUM_BLUE = 'medium blue'
  MEDIUM_ORCHID = 'medium orchid'
  MEDIUM_PURPLE = 'medium purple'
  MEDIUM_SEA_GREEN = 'medium sea green'
  MEDIUM_SLATE_BLUE = 'medium slate blue'
  MEDIUM_SPRING_GREEN = 'medium spring green'
  MEDIUM_TURQUOISE = 'medium turquoise'
  MEDIUM_VIOLET_RED = 'medium violet red'
  MEDIUMAQUAMARINE = 'MediumAquamarine'
  MEDIUMBLUE = 'MediumBlue'
  MEDIUMORCHID = 'MediumOrchid'
  MEDIUMORCHID1 = 'MediumOrchid1'
  MEDIUMORCHID2 = 'MediumOrchid2'
  MEDIUMORCHID3 = 'MediumOrchid3'
  MEDIUMORCHID4 = 'MediumOrchid4'
  MEDIUMPURPLE = 'MediumPurple'
  MEDIUMPURPLE1 = 'MediumPurple1'
  MEDIUMPURPLE2 = 'MediumPurple2'
  MEDIUMPURPLE3 = 'MediumPurple3'
  MEDIUMPURPLE4 = 'MediumPurple4'
  MEDIUMSEAGREEN = 'MediumSeaGreen'
  MEDIUMSLATEBLUE = 'MediumSlateBlue'
  MEDIUMSPRINGGREEN = 'MediumSpringGreen'
  MEDIUMTURQUOISE = 'MediumTurquoise'
  MEDIUMVIOLETRED = 'MediumVioletRed'
  MIDNIGHT_BLUE = 'midnight blue'
  MIDNIGHTBLUE = 'MidnightBlue'
  MINT_CREAM = 'mint cream'
  MINTCREAM = 'MintCream'
  MISTY_ROSE = 'misty rose'
  MISTYROSE = 'MistyRose'
  MISTYROSE1 = 'MistyRose1'
  MISTYROSE2 = 'MistyRose2'
  MISTYROSE3 = 'MistyRose3'
  MISTYROSE4 = 'MistyRose4'
  MOCCASIN = 'moccasin'
  NAVAJO_WHITE = 'navajo white'
  NAVAJOWHITE = 'NavajoWhite'
  NAVAJOWHITE1 = 'NavajoWhite1'
  NAVAJOWHITE2 = 'NavajoWhite2'
  NAVAJOWHITE3 = 'NavajoWhite3'
  NAVAJOWHITE4 = 'NavajoWhite4'
  NAVY = 'navy'
  NAVY_BLUE = 'navy blue'
  NAVYBLUE = 'NavyBlue'
  OLD_LACE = 'old lace'
  OLDLACE = 'OldLace'
  OLIVE_DRAB = 'olive drab'
  OLIVEDRAB = 'OliveDrab'
  OLIVEDRAB1 = 'OliveDrab1'
  OLIVEDRAB2 = 'OliveDrab2'
  OLIVEDRAB3 = 'OliveDrab3'
  OLIVEDRAB4 = 'OliveDrab4'
  ORANGE = 'orange'
  ORANGE_RED = 'orange red'
  ORANGE1 = 'orange1'
  ORANGE2 = 'orange2'
  ORANGE3 = 'orange3'
  ORANGE4 = 'orange4'
  ORANGERED = 'OrangeRed'
  ORANGERED1 = 'OrangeRed1'
  ORANGERED2 = 'OrangeRed2'
  ORANGERED3 = 'OrangeRed3'
  ORANGERED4 = 'OrangeRed4'
  ORCHID = 'orchid'
  ORCHID1 = 'orchid1'
  ORCHID2 = 'orchid2'
  ORCHID3 = 'orchid3'
  ORCHID4 = 'orchid4'
  PALE_GOLDENROD = 'pale goldenrod'
  PALE_GREEN = 'pale green'
  PALE_TURQUOISE = 'pale turquoise'
  PALE_VIOLET_RED = 'pale violet red'
  PALEGOLDENROD = 'PaleGoldenrod'
  PALEGREEN = 'PaleGreen'
  PALEGREEN1 = 'PaleGreen1'
  PALEGREEN2 = 'PaleGreen2'
  PALEGREEN3 = 'PaleGreen3'
  PALEGREEN4 = 'PaleGreen4'
  PALETURQUOISE = 'PaleTurquoise'
  PALETURQUOISE1 = 'PaleTurquoise1'
  PALETURQUOISE2 = 'PaleTurquoise2'
  PALETURQUOISE3 = 'PaleTurquoise3'
  PALETURQUOISE4 = 'PaleTurquoise4'
  PALEVIOLETRED = 'PaleVioletRed'
  PALEVIOLETRED1 = 'PaleVioletRed1'
  PALEVIOLETRED2 = 'PaleVioletRed2'
  PALEVIOLETRED3 = 'PaleVioletRed3'
  PALEVIOLETRED4 = 'PaleVioletRed4'
  PAPAYA_WHIP = 'papaya whip'
  PAPAYAWHIP = 'PapayaWhip'
  PEACH_PUFF = 'peach puff'
  PEACHPUFF = 'PeachPuff'
  PEACHPUFF1 = 'PeachPuff1'
  PEACHPUFF2 = 'PeachPuff2'
  PEACHPUFF3 = 'PeachPuff3'
  PEACHPUFF4 = 'PeachPuff4'
  PERU = 'peru'
  PINK = 'pink'
  PINK1 = 'pink1'
  PINK2 = 'pink2'
  PINK3 = 'pink3'
  PINK4 = 'pink4'
  PLUM = 'plum'
  PLUM1 = 'plum1'
  PLUM2 = 'plum2'
  PLUM3 = 'plum3'
  PLUM4 = 'plum4'
  POWDER_BLUE = 'powder blue'
  POWDERBLUE = 'PowderBlue'
  PURPLE = 'purple'
  PURPLE1 = 'purple1'
  PURPLE2 = 'purple2'
  PURPLE3 = 'purple3'
  PURPLE4 = 'purple4'
  RED = 'red'
  RED1 = 'red1'
  RED2 = 'red2'
  RED3 = 'red3'
  RED4 = 'red4'
  ROSY_BROWN = 'rosy brown'
  ROSYBROWN = 'RosyBrown'
  ROSYBROWN1 = 'RosyBrown1'
  ROSYBROWN2 = 'RosyBrown2'
  ROSYBROWN3 = 'RosyBrown3'
  ROSYBROWN4 = 'RosyBrown4'
  ROYAL_BLUE = 'royal blue'
  ROYALBLUE = 'RoyalBlue'
  ROYALBLUE1 = 'RoyalBlue1'
  ROYALBLUE2 = 'RoyalBlue2'
  ROYALBLUE3 = 'RoyalBlue3'
  ROYALBLUE4 = 'RoyalBlue4'
  SADDLE_BROWN = 'saddle brown'
  SADDLEBROWN = 'SaddleBrown'
  SALMON = 'salmon'
  SALMON1 = 'salmon1'
  SALMON2 = 'salmon2'
  SALMON3 = 'salmon3'
  SALMON4 = 'salmon4'
  SANDY_BROWN = 'sandy brown'
  SANDYBROWN = 'SandyBrown'
  SEA_GREEN = 'sea green'
  SEAGREEN = 'SeaGreen'
  SEAGREEN1 = 'SeaGreen1'
  SEAGREEN2 = 'SeaGreen2'
  SEAGREEN3 = 'SeaGreen3'
  SEAGREEN4 = 'SeaGreen4'
  SEASHELL = 'seashell'
  SEASHELL1 = 'seashell1'
  SEASHELL2 = 'seashell2'
  SEASHELL3 = 'seashell3'
  SEASHELL4 = 'seashell4'
  SIENNA = 'sienna'
  SIENNA1 = 'sienna1'
  SIENNA2 = 'sienna2'
  SIENNA3 = 'sienna3'
  SIENNA4 = 'sienna4'
  SKY_BLUE = 'sky blue'
  SKYBLUE = 'SkyBlue'
  SKYBLUE1 = 'SkyBlue1'
  SKYBLUE2 = 'SkyBlue2'
  SKYBLUE3 = 'SkyBlue3'
  SKYBLUE4 = 'SkyBlue4'
  SLATE_BLUE = 'slate blue'
  SLATE_GRAY = 'slate gray'
  SLATE_GREY = 'slate grey'
  SLATEBLUE = 'SlateBlue'
  SLATEBLUE1 = 'SlateBlue1'
  SLATEBLUE2 = 'SlateBlue2'
  SLATEBLUE3 = 'SlateBlue3'
  SLATEBLUE4 = 'SlateBlue4'
  SLATEGRAY = 'SlateGray'
  SLATEGRAY1 = 'SlateGray1'
  SLATEGRAY2 = 'SlateGray2'
  SLATEGRAY3 = 'SlateGray3'
  SLATEGRAY4 = 'SlateGray4'
  SLATEGREY = 'SlateGrey'
  SNOW = 'snow'
  SNOW1 = 'snow1'
  SNOW2 = 'snow2'
  SNOW3 = 'snow3'
  SNOW4 = 'snow4'
  SPRING_GREEN = 'spring green'
  SPRINGGREEN = 'SpringGreen'
  SPRINGGREEN1 = 'SpringGreen1'
  SPRINGGREEN2 = 'SpringGreen2'
  SPRINGGREEN3 = 'SpringGreen3'
  SPRINGGREEN4 = 'SpringGreen4'
  STEEL_BLUE = 'steel blue'
  STEELBLUE = 'SteelBlue'
  STEELBLUE1 = 'SteelBlue1'
  STEELBLUE2 = 'SteelBlue2'
  STEELBLUE3 = 'SteelBlue3'
  STEELBLUE4 = 'SteelBlue4'
  TAN = 'tan'
  TAN1 = 'tan1'
  TAN2 = 'tan2'
  TAN3 = 'tan3'
  TAN4 = 'tan4'
  THISTLE = 'thistle'
  THISTLE1 = 'thistle1'
  THISTLE2 = 'thistle2'
  THISTLE3 = 'thistle3'
  THISTLE4 = 'thistle4'
  TOMATO = 'tomato'
  TOMATO1 = 'tomato1'
  TOMATO2 = 'tomato2'
  TOMATO3 = 'tomato3'
  TOMATO4 = 'tomato4'
  TURQUOISE = 'turquoise'
  TURQUOISE1 = 'turquoise1'
  TURQUOISE2 = 'turquoise2'
  TURQUOISE3 = 'turquoise3'
  TURQUOISE4 = 'turquoise4'
  VIOLET = 'violet'
  VIOLET_RED = 'violet red'
  VIOLETRED = 'VioletRed'
  VIOLETRED1 = 'VioletRed1'
  VIOLETRED2 = 'VioletRed2'
  VIOLETRED3 = 'VioletRed3'
  VIOLETRED4 = 'VioletRed4'
  WHEAT = 'wheat'
  WHEAT1 = 'wheat1'
  WHEAT2 = 'wheat2'
  WHEAT3 = 'wheat3'
  WHEAT4 = 'wheat4'
  WHITE = 'white'
  WHITE_SMOKE = 'white smoke'
  WHITESMOKE = 'WhiteSmoke'
  YELLOW = 'yellow'
  YELLOW_GREEN = 'yellow green'
  YELLOW1 = 'yellow1'
  YELLOW2 = 'yellow2'
  YELLOW3 = 'yellow3'
  YELLOW4 = 'yellow4'
  YELLOWGREEN = 'YellowGreen'
  NAME_TO_RGB = {'AliceBlue': (240, 248, 255), 'AntiqueWhite': (...
  NAME_TO_RGB_LC = {'alice blue': (240, 248, 255), 'aliceblue': ...
  NAME_TO_HEX_LC = {'alice blue': '#f0f8ff', 'aliceblue': '#f0f8...
  RGB_TO_NAME = {(0, 0, 0): 'black', (0, 0, 128): 'NavyBlue', (0...
  HEX_TO_NAME = {'#000000': 'black', '#000080': 'NavyBlue', '#00...
Method Details

to_hex(*args)
Static Method

 

Converts a color into a hex color string such as "#ff00ff". Accepts a Color in any format, such as a Color object, a color name, a hex string, or tuple of three RGB integers from 0-255. If an invalid color is passed, raises a ValueError.

to_name(*args)
Static Method

 

Converts a color into a color name string such as "red" or "light sky blue". Accepts a Color in any format, such as a Color object, a color name, a hex string, or tuple of three RGB integers from 0-255. If an invalid color is passed, or one that does not correspond to a color name, returns the hex string version of the color.

to_rgb(*args)
Static Method

 

Converts a color into an RGB tuple such as (255, 0, 128). Accepts a Color in any format, such as a Color object, a color name, a hex string, or tuple of three RGB integers from 0-255. If an invalid color is passed, or one that does not correspond to a color name, raises a ValueError.

normalize_all_colors(options)
Static Method

 

Makes sure that any color values in the given dict are in normalized hex string form, not tuples or color names. Not to be called by students.


Class Variable Details

NAME_TO_RGB

Value:
{'AliceBlue': (240, 248, 255),
 'AntiqueWhite': (250, 235, 215),
 'AntiqueWhite1': (255, 239, 219),
 'AntiqueWhite2': (238, 223, 204),
 'AntiqueWhite3': (205, 192, 176),
 'AntiqueWhite4': (139, 131, 120),
 'BlanchedAlmond': (255, 235, 205),
 'BlueViolet': (138, 43, 226),
...

NAME_TO_RGB_LC

Value:
{'alice blue': (240, 248, 255),
 'aliceblue': (240, 248, 255),
 'antique white': (250, 235, 215),
 'antiquewhite': (250, 235, 215),
 'antiquewhite1': (255, 239, 219),
 'antiquewhite2': (238, 223, 204),
 'antiquewhite3': (205, 192, 176),
 'antiquewhite4': (139, 131, 120),
...

NAME_TO_HEX_LC

Value:
{'alice blue': '#f0f8ff',
 'aliceblue': '#f0f8ff',
 'antique white': '#faebd7',
 'antiquewhite': '#faebd7',
 'antiquewhite1': '#ffefdb',
 'antiquewhite2': '#eedfcc',
 'antiquewhite3': '#cdc0b0',
 'antiquewhite4': '#8b8378',
...

RGB_TO_NAME

Value:
{(0, 0, 0): 'black',
 (0, 0, 128): 'NavyBlue',
 (0, 0, 139): 'DarkBlue',
 (0, 0, 205): 'MediumBlue',
 (0, 0, 238): 'blue2',
 (0, 0, 255): 'blue1',
 (0, 100, 0): 'DarkGreen',
 (0, 104, 139): 'DeepSkyBlue4',
...

HEX_TO_NAME

Value:
{'#000000': 'black',
 '#000080': 'NavyBlue',
 '#00008b': 'DarkBlue',
 '#0000cd': 'MediumBlue',
 '#0000ee': 'blue2',
 '#0000ff': 'blue1',
 '#006400': 'DarkGreen',
 '#00688b': 'DeepSkyBlue4',
...