Update colors.nim (#19274)
* Update colors.nim Added `lightgray` alias to `lightgrey` and `...grey`aliases for the rest of the gray colors. Added color `rebeccapurple`. Fixed the incorrect values for the `PaleVioletRed` and `MediumPurple` colors. This module should now be matching the CSS colors. I used the seq[tuple] syntax for defining the names. * Document colors changes.
This commit is contained in:
parent
b812431f83
commit
ea475a4e98
2 changed files with 164 additions and 145 deletions
|
|
@ -15,11 +15,13 @@
|
||||||
`experimental:flexibleOptionalParams`.
|
`experimental:flexibleOptionalParams`.
|
||||||
|
|
||||||
- `std/sharedstrings` module is removed.
|
- `std/sharedstrings` module is removed.
|
||||||
|
- Constants `colors.colPaleVioletRed` and `colors.colMediumPurple` changed to match the CSS color standard.
|
||||||
|
|
||||||
## Standard library additions and changes
|
## Standard library additions and changes
|
||||||
|
|
||||||
- `macros.parseExpr` and `macros.parseStmt` now accept an optional
|
- `macros.parseExpr` and `macros.parseStmt` now accept an optional
|
||||||
filename argument for more informative errors.
|
filename argument for more informative errors.
|
||||||
|
- Module `colors` expanded with missing colors from the CSS color standard.
|
||||||
|
|
||||||
## `std/smtp`
|
## `std/smtp`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
## This module implements color handling for Nim.
|
## This module implements color handling for Nim,
|
||||||
|
## namely color mixing and parsing the CSS color names.
|
||||||
|
|
||||||
import strutils
|
import strutils
|
||||||
from algorithm import binarySearch
|
from algorithm import binarySearch
|
||||||
|
|
@ -170,6 +171,7 @@ const
|
||||||
colDarkGoldenRod* = Color(0xB8860B)
|
colDarkGoldenRod* = Color(0xB8860B)
|
||||||
colDarkGray* = Color(0xA9A9A9)
|
colDarkGray* = Color(0xA9A9A9)
|
||||||
colDarkGreen* = Color(0x006400)
|
colDarkGreen* = Color(0x006400)
|
||||||
|
colDarkGrey* = Color(0xA9A9A9)
|
||||||
colDarkKhaki* = Color(0xBDB76B)
|
colDarkKhaki* = Color(0xBDB76B)
|
||||||
colDarkMagenta* = Color(0x8B008B)
|
colDarkMagenta* = Color(0x8B008B)
|
||||||
colDarkOliveGreen* = Color(0x556B2F)
|
colDarkOliveGreen* = Color(0x556B2F)
|
||||||
|
|
@ -180,11 +182,13 @@ const
|
||||||
colDarkSeaGreen* = Color(0x8FBC8F)
|
colDarkSeaGreen* = Color(0x8FBC8F)
|
||||||
colDarkSlateBlue* = Color(0x483D8B)
|
colDarkSlateBlue* = Color(0x483D8B)
|
||||||
colDarkSlateGray* = Color(0x2F4F4F)
|
colDarkSlateGray* = Color(0x2F4F4F)
|
||||||
|
colDarkSlateGrey* = Color(0x2F4F4F)
|
||||||
colDarkTurquoise* = Color(0x00CED1)
|
colDarkTurquoise* = Color(0x00CED1)
|
||||||
colDarkViolet* = Color(0x9400D3)
|
colDarkViolet* = Color(0x9400D3)
|
||||||
colDeepPink* = Color(0xFF1493)
|
colDeepPink* = Color(0xFF1493)
|
||||||
colDeepSkyBlue* = Color(0x00BFFF)
|
colDeepSkyBlue* = Color(0x00BFFF)
|
||||||
colDimGray* = Color(0x696969)
|
colDimGray* = Color(0x696969)
|
||||||
|
colDimGrey* = Color(0x696969)
|
||||||
colDodgerBlue* = Color(0x1E90FF)
|
colDodgerBlue* = Color(0x1E90FF)
|
||||||
colFireBrick* = Color(0xB22222)
|
colFireBrick* = Color(0xB22222)
|
||||||
colFloralWhite* = Color(0xFFFAF0)
|
colFloralWhite* = Color(0xFFFAF0)
|
||||||
|
|
@ -196,6 +200,7 @@ const
|
||||||
colGoldenRod* = Color(0xDAA520)
|
colGoldenRod* = Color(0xDAA520)
|
||||||
colGray* = Color(0x808080)
|
colGray* = Color(0x808080)
|
||||||
colGreen* = Color(0x008000)
|
colGreen* = Color(0x008000)
|
||||||
|
colGrey* = Color(0x808080)
|
||||||
colGreenYellow* = Color(0xADFF2F)
|
colGreenYellow* = Color(0xADFF2F)
|
||||||
colHoneyDew* = Color(0xF0FFF0)
|
colHoneyDew* = Color(0xF0FFF0)
|
||||||
colHotPink* = Color(0xFF69B4)
|
colHotPink* = Color(0xFF69B4)
|
||||||
|
|
@ -211,13 +216,15 @@ const
|
||||||
colLightCoral* = Color(0xF08080)
|
colLightCoral* = Color(0xF08080)
|
||||||
colLightCyan* = Color(0xE0FFFF)
|
colLightCyan* = Color(0xE0FFFF)
|
||||||
colLightGoldenRodYellow* = Color(0xFAFAD2)
|
colLightGoldenRodYellow* = Color(0xFAFAD2)
|
||||||
colLightGrey* = Color(0xD3D3D3)
|
colLightGray* = Color(0xD3D3D3)
|
||||||
colLightGreen* = Color(0x90EE90)
|
colLightGreen* = Color(0x90EE90)
|
||||||
|
colLightGrey* = Color(0xD3D3D3)
|
||||||
colLightPink* = Color(0xFFB6C1)
|
colLightPink* = Color(0xFFB6C1)
|
||||||
colLightSalmon* = Color(0xFFA07A)
|
colLightSalmon* = Color(0xFFA07A)
|
||||||
colLightSeaGreen* = Color(0x20B2AA)
|
colLightSeaGreen* = Color(0x20B2AA)
|
||||||
colLightSkyBlue* = Color(0x87CEFA)
|
colLightSkyBlue* = Color(0x87CEFA)
|
||||||
colLightSlateGray* = Color(0x778899)
|
colLightSlateGray* = Color(0x778899)
|
||||||
|
colLightSlateGrey* = Color(0x778899)
|
||||||
colLightSteelBlue* = Color(0xB0C4DE)
|
colLightSteelBlue* = Color(0xB0C4DE)
|
||||||
colLightYellow* = Color(0xFFFFE0)
|
colLightYellow* = Color(0xFFFFE0)
|
||||||
colLime* = Color(0x00FF00)
|
colLime* = Color(0x00FF00)
|
||||||
|
|
@ -228,7 +235,7 @@ const
|
||||||
colMediumAquaMarine* = Color(0x66CDAA)
|
colMediumAquaMarine* = Color(0x66CDAA)
|
||||||
colMediumBlue* = Color(0x0000CD)
|
colMediumBlue* = Color(0x0000CD)
|
||||||
colMediumOrchid* = Color(0xBA55D3)
|
colMediumOrchid* = Color(0xBA55D3)
|
||||||
colMediumPurple* = Color(0x9370D8)
|
colMediumPurple* = Color(0x9370DB)
|
||||||
colMediumSeaGreen* = Color(0x3CB371)
|
colMediumSeaGreen* = Color(0x3CB371)
|
||||||
colMediumSlateBlue* = Color(0x7B68EE)
|
colMediumSlateBlue* = Color(0x7B68EE)
|
||||||
colMediumSpringGreen* = Color(0x00FA9A)
|
colMediumSpringGreen* = Color(0x00FA9A)
|
||||||
|
|
@ -249,7 +256,7 @@ const
|
||||||
colPaleGoldenRod* = Color(0xEEE8AA)
|
colPaleGoldenRod* = Color(0xEEE8AA)
|
||||||
colPaleGreen* = Color(0x98FB98)
|
colPaleGreen* = Color(0x98FB98)
|
||||||
colPaleTurquoise* = Color(0xAFEEEE)
|
colPaleTurquoise* = Color(0xAFEEEE)
|
||||||
colPaleVioletRed* = Color(0xD87093)
|
colPaleVioletRed* = Color(0xDB7093)
|
||||||
colPapayaWhip* = Color(0xFFEFD5)
|
colPapayaWhip* = Color(0xFFEFD5)
|
||||||
colPeachPuff* = Color(0xFFDAB9)
|
colPeachPuff* = Color(0xFFDAB9)
|
||||||
colPeru* = Color(0xCD853F)
|
colPeru* = Color(0xCD853F)
|
||||||
|
|
@ -257,6 +264,7 @@ const
|
||||||
colPlum* = Color(0xDDA0DD)
|
colPlum* = Color(0xDDA0DD)
|
||||||
colPowderBlue* = Color(0xB0E0E6)
|
colPowderBlue* = Color(0xB0E0E6)
|
||||||
colPurple* = Color(0x800080)
|
colPurple* = Color(0x800080)
|
||||||
|
colRebeccaPurple* = Color(0x663399)
|
||||||
colRed* = Color(0xFF0000)
|
colRed* = Color(0xFF0000)
|
||||||
colRosyBrown* = Color(0xBC8F8F)
|
colRosyBrown* = Color(0xBC8F8F)
|
||||||
colRoyalBlue* = Color(0x4169E1)
|
colRoyalBlue* = Color(0x4169E1)
|
||||||
|
|
@ -270,6 +278,7 @@ const
|
||||||
colSkyBlue* = Color(0x87CEEB)
|
colSkyBlue* = Color(0x87CEEB)
|
||||||
colSlateBlue* = Color(0x6A5ACD)
|
colSlateBlue* = Color(0x6A5ACD)
|
||||||
colSlateGray* = Color(0x708090)
|
colSlateGray* = Color(0x708090)
|
||||||
|
colSlateGrey* = Color(0x708090)
|
||||||
colSnow* = Color(0xFFFAFA)
|
colSnow* = Color(0xFFFAFA)
|
||||||
colSpringGreen* = Color(0x00FF7F)
|
colSpringGreen* = Color(0x00FF7F)
|
||||||
colSteelBlue* = Color(0x4682B4)
|
colSteelBlue* = Color(0x4682B4)
|
||||||
|
|
@ -285,147 +294,155 @@ const
|
||||||
colYellow* = Color(0xFFFF00)
|
colYellow* = Color(0xFFFF00)
|
||||||
colYellowGreen* = Color(0x9ACD32)
|
colYellowGreen* = Color(0x9ACD32)
|
||||||
|
|
||||||
colorNames = [
|
colorNames = {
|
||||||
("aliceblue", colAliceBlue),
|
"aliceblue": colAliceBlue,
|
||||||
("antiquewhite", colAntiqueWhite),
|
"antiquewhite": colAntiqueWhite,
|
||||||
("aqua", colAqua),
|
"aqua": colAqua,
|
||||||
("aquamarine", colAquamarine),
|
"aquamarine": colAquamarine,
|
||||||
("azure", colAzure),
|
"azure": colAzure,
|
||||||
("beige", colBeige),
|
"beige": colBeige,
|
||||||
("bisque", colBisque),
|
"bisque": colBisque,
|
||||||
("black", colBlack),
|
"black": colBlack,
|
||||||
("blanchedalmond", colBlanchedAlmond),
|
"blanchedalmond": colBlanchedAlmond,
|
||||||
("blue", colBlue),
|
"blue": colBlue,
|
||||||
("blueviolet", colBlueViolet),
|
"blueviolet": colBlueViolet,
|
||||||
("brown", colBrown),
|
"brown": colBrown,
|
||||||
("burlywood", colBurlyWood),
|
"burlywood": colBurlyWood,
|
||||||
("cadetblue", colCadetBlue),
|
"cadetblue": colCadetBlue,
|
||||||
("chartreuse", colChartreuse),
|
"chartreuse": colChartreuse,
|
||||||
("chocolate", colChocolate),
|
"chocolate": colChocolate,
|
||||||
("coral", colCoral),
|
"coral": colCoral,
|
||||||
("cornflowerblue", colCornflowerBlue),
|
"cornflowerblue": colCornflowerBlue,
|
||||||
("cornsilk", colCornsilk),
|
"cornsilk": colCornsilk,
|
||||||
("crimson", colCrimson),
|
"crimson": colCrimson,
|
||||||
("cyan", colCyan),
|
"cyan": colCyan,
|
||||||
("darkblue", colDarkBlue),
|
"darkblue": colDarkBlue,
|
||||||
("darkcyan", colDarkCyan),
|
"darkcyan": colDarkCyan,
|
||||||
("darkgoldenrod", colDarkGoldenRod),
|
"darkgoldenrod": colDarkGoldenRod,
|
||||||
("darkgray", colDarkGray),
|
"darkgray": colDarkGray,
|
||||||
("darkgreen", colDarkGreen),
|
"darkgreen": colDarkGreen,
|
||||||
("darkkhaki", colDarkKhaki),
|
"darkgrey": colDarkGrey,
|
||||||
("darkmagenta", colDarkMagenta),
|
"darkkhaki": colDarkKhaki,
|
||||||
("darkolivegreen", colDarkOliveGreen),
|
"darkmagenta": colDarkMagenta,
|
||||||
("darkorange", colDarkorange),
|
"darkolivegreen": colDarkOliveGreen,
|
||||||
("darkorchid", colDarkOrchid),
|
"darkorange": colDarkorange,
|
||||||
("darkred", colDarkRed),
|
"darkorchid": colDarkOrchid,
|
||||||
("darksalmon", colDarkSalmon),
|
"darkred": colDarkRed,
|
||||||
("darkseagreen", colDarkSeaGreen),
|
"darksalmon": colDarkSalmon,
|
||||||
("darkslateblue", colDarkSlateBlue),
|
"darkseagreen": colDarkSeaGreen,
|
||||||
("darkslategray", colDarkSlateGray),
|
"darkslateblue": colDarkSlateBlue,
|
||||||
("darkturquoise", colDarkTurquoise),
|
"darkslategray": colDarkSlateGray,
|
||||||
("darkviolet", colDarkViolet),
|
"darkslategrey": colDarkSlateGrey,
|
||||||
("deeppink", colDeepPink),
|
"darkturquoise": colDarkTurquoise,
|
||||||
("deepskyblue", colDeepSkyBlue),
|
"darkviolet": colDarkViolet,
|
||||||
("dimgray", colDimGray),
|
"deeppink": colDeepPink,
|
||||||
("dodgerblue", colDodgerBlue),
|
"deepskyblue": colDeepSkyBlue,
|
||||||
("firebrick", colFireBrick),
|
"dimgray": colDimGray,
|
||||||
("floralwhite", colFloralWhite),
|
"dimgrey": colDimGrey,
|
||||||
("forestgreen", colForestGreen),
|
"dodgerblue": colDodgerBlue,
|
||||||
("fuchsia", colFuchsia),
|
"firebrick": colFireBrick,
|
||||||
("gainsboro", colGainsboro),
|
"floralwhite": colFloralWhite,
|
||||||
("ghostwhite", colGhostWhite),
|
"forestgreen": colForestGreen,
|
||||||
("gold", colGold),
|
"fuchsia": colFuchsia,
|
||||||
("goldenrod", colGoldenRod),
|
"gainsboro": colGainsboro,
|
||||||
("gray", colGray),
|
"ghostwhite": colGhostWhite,
|
||||||
("green", colGreen),
|
"gold": colGold,
|
||||||
("greenyellow", colGreenYellow),
|
"goldenrod": colGoldenRod,
|
||||||
("honeydew", colHoneyDew),
|
"gray": colGray,
|
||||||
("hotpink", colHotPink),
|
"green": colGreen,
|
||||||
("indianred", colIndianRed),
|
"grey": colGrey,
|
||||||
("indigo", colIndigo),
|
"greenyellow": colGreenYellow,
|
||||||
("ivory", colIvory),
|
"honeydew": colHoneyDew,
|
||||||
("khaki", colKhaki),
|
"hotpink": colHotPink,
|
||||||
("lavender", colLavender),
|
"indianred": colIndianRed,
|
||||||
("lavenderblush", colLavenderBlush),
|
"indigo": colIndigo,
|
||||||
("lawngreen", colLawnGreen),
|
"ivory": colIvory,
|
||||||
("lemonchiffon", colLemonChiffon),
|
"khaki": colKhaki,
|
||||||
("lightblue", colLightBlue),
|
"lavender": colLavender,
|
||||||
("lightcoral", colLightCoral),
|
"lavenderblush": colLavenderBlush,
|
||||||
("lightcyan", colLightCyan),
|
"lawngreen": colLawnGreen,
|
||||||
("lightgoldenrodyellow", colLightGoldenRodYellow),
|
"lemonchiffon": colLemonChiffon,
|
||||||
("lightgreen", colLightGreen),
|
"lightblue": colLightBlue,
|
||||||
("lightgrey", colLightGrey),
|
"lightcoral": colLightCoral,
|
||||||
("lightpink", colLightPink),
|
"lightcyan": colLightCyan,
|
||||||
("lightsalmon", colLightSalmon),
|
"lightgoldenrodyellow": colLightGoldenRodYellow,
|
||||||
("lightseagreen", colLightSeaGreen),
|
"lightgray": colLightGray,
|
||||||
("lightskyblue", colLightSkyBlue),
|
"lightgreen": colLightGreen,
|
||||||
("lightslategray", colLightSlateGray),
|
"lightgrey": colLightGrey,
|
||||||
("lightsteelblue", colLightSteelBlue),
|
"lightpink": colLightPink,
|
||||||
("lightyellow", colLightYellow),
|
"lightsalmon": colLightSalmon,
|
||||||
("lime", colLime),
|
"lightseagreen": colLightSeaGreen,
|
||||||
("limegreen", colLimeGreen),
|
"lightskyblue": colLightSkyBlue,
|
||||||
("linen", colLinen),
|
"lightslategray": colLightSlateGray,
|
||||||
("magenta", colMagenta),
|
"lightslategrey": colLightSlateGrey,
|
||||||
("maroon", colMaroon),
|
"lightsteelblue": colLightSteelBlue,
|
||||||
("mediumaquamarine", colMediumAquaMarine),
|
"lightyellow": colLightYellow,
|
||||||
("mediumblue", colMediumBlue),
|
"lime": colLime,
|
||||||
("mediumorchid", colMediumOrchid),
|
"limegreen": colLimeGreen,
|
||||||
("mediumpurple", colMediumPurple),
|
"linen": colLinen,
|
||||||
("mediumseagreen", colMediumSeaGreen),
|
"magenta": colMagenta,
|
||||||
("mediumslateblue", colMediumSlateBlue),
|
"maroon": colMaroon,
|
||||||
("mediumspringgreen", colMediumSpringGreen),
|
"mediumaquamarine": colMediumAquaMarine,
|
||||||
("mediumturquoise", colMediumTurquoise),
|
"mediumblue": colMediumBlue,
|
||||||
("mediumvioletred", colMediumVioletRed),
|
"mediumorchid": colMediumOrchid,
|
||||||
("midnightblue", colMidnightBlue),
|
"mediumpurple": colMediumPurple,
|
||||||
("mintcream", colMintCream),
|
"mediumseagreen": colMediumSeaGreen,
|
||||||
("mistyrose", colMistyRose),
|
"mediumslateblue": colMediumSlateBlue,
|
||||||
("moccasin", colMoccasin),
|
"mediumspringgreen": colMediumSpringGreen,
|
||||||
("navajowhite", colNavajoWhite),
|
"mediumturquoise": colMediumTurquoise,
|
||||||
("navy", colNavy),
|
"mediumvioletred": colMediumVioletRed,
|
||||||
("oldlace", colOldLace),
|
"midnightblue": colMidnightBlue,
|
||||||
("olive", colOlive),
|
"mintcream": colMintCream,
|
||||||
("olivedrab", colOliveDrab),
|
"mistyrose": colMistyRose,
|
||||||
("orange", colOrange),
|
"moccasin": colMoccasin,
|
||||||
("orangered", colOrangeRed),
|
"navajowhite": colNavajoWhite,
|
||||||
("orchid", colOrchid),
|
"navy": colNavy,
|
||||||
("palegoldenrod", colPaleGoldenRod),
|
"oldlace": colOldLace,
|
||||||
("palegreen", colPaleGreen),
|
"olive": colOlive,
|
||||||
("paleturquoise", colPaleTurquoise),
|
"olivedrab": colOliveDrab,
|
||||||
("palevioletred", colPaleVioletRed),
|
"orange": colOrange,
|
||||||
("papayawhip", colPapayaWhip),
|
"orangered": colOrangeRed,
|
||||||
("peachpuff", colPeachPuff),
|
"orchid": colOrchid,
|
||||||
("peru", colPeru),
|
"palegoldenrod": colPaleGoldenRod,
|
||||||
("pink", colPink),
|
"palegreen": colPaleGreen,
|
||||||
("plum", colPlum),
|
"paleturquoise": colPaleTurquoise,
|
||||||
("powderblue", colPowderBlue),
|
"palevioletred": colPaleVioletRed,
|
||||||
("purple", colPurple),
|
"papayawhip": colPapayaWhip,
|
||||||
("red", colRed),
|
"peachpuff": colPeachPuff,
|
||||||
("rosybrown", colRosyBrown),
|
"peru": colPeru,
|
||||||
("royalblue", colRoyalBlue),
|
"pink": colPink,
|
||||||
("saddlebrown", colSaddleBrown),
|
"plum": colPlum,
|
||||||
("salmon", colSalmon),
|
"powderblue": colPowderBlue,
|
||||||
("sandybrown", colSandyBrown),
|
"purple": colPurple,
|
||||||
("seagreen", colSeaGreen),
|
"rebeccapurple": colRebeccaPurple,
|
||||||
("seashell", colSeaShell),
|
"red": colRed,
|
||||||
("sienna", colSienna),
|
"rosybrown": colRosyBrown,
|
||||||
("silver", colSilver),
|
"royalblue": colRoyalBlue,
|
||||||
("skyblue", colSkyBlue),
|
"saddlebrown": colSaddleBrown,
|
||||||
("slateblue", colSlateBlue),
|
"salmon": colSalmon,
|
||||||
("slategray", colSlateGray),
|
"sandybrown": colSandyBrown,
|
||||||
("snow", colSnow),
|
"seagreen": colSeaGreen,
|
||||||
("springgreen", colSpringGreen),
|
"seashell": colSeaShell,
|
||||||
("steelblue", colSteelBlue),
|
"sienna": colSienna,
|
||||||
("tan", colTan),
|
"silver": colSilver,
|
||||||
("teal", colTeal),
|
"skyblue": colSkyBlue,
|
||||||
("thistle", colThistle),
|
"slateblue": colSlateBlue,
|
||||||
("tomato", colTomato),
|
"slategray": colSlateGray,
|
||||||
("turquoise", colTurquoise),
|
"slategrey": colSlateGrey,
|
||||||
("violet", colViolet),
|
"snow": colSnow,
|
||||||
("wheat", colWheat),
|
"springgreen": colSpringGreen,
|
||||||
("white", colWhite),
|
"steelblue": colSteelBlue,
|
||||||
("whitesmoke", colWhiteSmoke),
|
"tan": colTan,
|
||||||
("yellow", colYellow),
|
"teal": colTeal,
|
||||||
("yellowgreen", colYellowGreen)]
|
"thistle": colThistle,
|
||||||
|
"tomato": colTomato,
|
||||||
|
"turquoise": colTurquoise,
|
||||||
|
"violet": colViolet,
|
||||||
|
"wheat": colWheat,
|
||||||
|
"white": colWhite,
|
||||||
|
"whitesmoke": colWhiteSmoke,
|
||||||
|
"yellow": colYellow,
|
||||||
|
"yellowgreen": colYellowGreen}
|
||||||
|
|
||||||
proc `$`*(c: Color): string =
|
proc `$`*(c: Color): string =
|
||||||
## Converts a color into its textual representation.
|
## Converts a color into its textual representation.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue