Browse Source

Externalize colors definitions to separate header file.

merge-requests/827/head
morg 2 months ago
committed by Adam Honse
parent
commit
12ffcccdcd
  1. 152
      Colors.h
  2. 1
      OpenRGB.pro
  3. 297
      cli.cpp

152
Colors.h

@ -0,0 +1,152 @@
#ifndef COLORS_H
#define COLORS_H
#define COLOR_BLACK 0x000000
#define COLOR_NAVY 0x000080
#define COLOR_DARKBLUE 0x00008b
#define COLOR_MEDIUMBLUE 0x0000cd
#define COLOR_BLUE 0x0000ff
#define COLOR_DARKGREEN 0x006400
#define COLOR_GREEN 0x008000
#define COLOR_TEAL 0x008080
#define COLOR_DARKCYAN 0x008b8b
#define COLOR_DEEPSKYBLUE 0x00bfff
#define COLOR_DARKTURQUOISE 0x00ced1
#define COLOR_MEDIUMSPRINGGREEN 0x00fa9a
#define COLOR_LIME 0x00ff00
#define COLOR_SPRINGGREEN 0x00ff7f
#define COLOR_AQUA 0x00ffff
#define COLOR_CYAN 0x00ffff
#define COLOR_MIDNIGHTBLUE 0x191970
#define COLOR_DODGERBLUE 0x1e90ff
#define COLOR_LIGHTSEAGREEN 0x20b2aa
#define COLOR_FORESTGREEN 0x228b22
#define COLOR_SEAGREEN 0x2e8b57
#define COLOR_DARKSLATEGRAY 0x2f4f4f
#define COLOR_DARKSLATEGREY 0x2f4f4f
#define COLOR_LIMEGREEN 0x32cd32
#define COLOR_MEDIUMSEAGREEN 0x3cb371
#define COLOR_TURQUOISE 0x40e0d0
#define COLOR_ROYALBLUE 0x4169e1
#define COLOR_STEELBLUE 0x4682b4
#define COLOR_DARKSLATEBLUE 0x483d8b
#define COLOR_MEDIUMTURQUOISE 0x48d1cc
#define COLOR_INDIGO 0x4b0082
#define COLOR_DARKOLIVEGREEN 0x556b2f
#define COLOR_CADETBLUE 0x5f9ea0
#define COLOR_CORNFLOWERBLUE 0x6495ed
#define COLOR_MEDIUMAQUAMARINE 0x66cdaa
#define COLOR_DIMGRAY 0x696969
#define COLOR_DIMGREY 0x696969
#define COLOR_SLATEBLUE 0x6a5acd
#define COLOR_OLIVEDRAB 0x6b8e23
#define COLOR_SLATEGRAY 0x708090
#define COLOR_SLATEGREY 0x708090
#define COLOR_LIGHTSLATEGRAY 0x778899
#define COLOR_LIGHTSLATEGREY 0x778899
#define COLOR_MEDIUMSLATEBLUE 0x7b68ee
#define COLOR_LAWNGREEN 0x7cfc00
#define COLOR_CHARTREUSE 0x7fff00
#define COLOR_AQUAMARINE 0x7fffd4
#define COLOR_MAROON 0x800000
#define COLOR_PURPLE 0x800080
#define COLOR_OLIVE 0x808000
#define COLOR_GRAY 0x808080
#define COLOR_GREY 0x808080
#define COLOR_SKYBLUE 0x87ceeb
#define COLOR_LIGHTSKYBLUE 0x87cefa
#define COLOR_BLUEVIOLET 0x8a2be2
#define COLOR_DARKRED 0x8b0000
#define COLOR_DARKMAGENTA 0x8b008b
#define COLOR_SADDLEBROWN 0x8b4513
#define COLOR_DARKSEAGREEN 0x8fbc8f
#define COLOR_LIGHTGREEN 0x90ee90
#define COLOR_MEDIUMPURPLE 0x9370db
#define COLOR_DARKVIOLET 0x9400d3
#define COLOR_PALEGREEN 0x98fb98
#define COLOR_DARKORCHID 0x9932cc
#define COLOR_YELLOWGREEN 0x9acd32
#define COLOR_SIENNA 0xa0522d
#define COLOR_BROWN 0xa52a2a
#define COLOR_DARKGRAY 0xa9a9a9
#define COLOR_DARKGREY 0xa9a9a9
#define COLOR_LIGHTBLUE 0xadd8e6
#define COLOR_GREENYELLOW 0xadff2f
#define COLOR_PALETURQUOISE 0xafeeee
#define COLOR_LIGHTSTEELBLUE 0xb0c4de
#define COLOR_POWDERBLUE 0xb0e0e6
#define COLOR_FIREBRICK 0xb22222
#define COLOR_DARKGOLDENROD 0xb8860b
#define COLOR_MEDIUMORCHID 0xba55d3
#define COLOR_ROSYBROWN 0xbc8f8f
#define COLOR_DARKKHAKI 0xbdb76b
#define COLOR_SILVER 0xc0c0c0
#define COLOR_MEDIUMVIOLETRED 0xc71585
#define COLOR_INDIANRED 0xcd5c5c
#define COLOR_PERU 0xcd853f
#define COLOR_CHOCOLATE 0xd2691e
#define COLOR_TAN 0xd2b48c
#define COLOR_LIGHTGRAY 0xd3d3d3
#define COLOR_LIGHTGREY 0xd3d3d3
#define COLOR_THISTLE 0xd8bfd8
#define COLOR_ORCHID 0xda70d6
#define COLOR_GOLDENROD 0xdaa520
#define COLOR_PALEVIOLETRED 0xdb7093
#define COLOR_CRIMSON 0xdc143c
#define COLOR_GAINSBORO 0xdcdcdc
#define COLOR_PLUM 0xdda0dd
#define COLOR_BURLYWOOD 0xdeb887
#define COLOR_LIGHTCYAN 0xe0ffff
#define COLOR_LAVENDER 0xe6e6fa
#define COLOR_DARKSALMON 0xe9967a
#define COLOR_VIOLET 0xee82ee
#define COLOR_PALEGOLDENROD 0xeee8aa
#define COLOR_LIGHTCORAL 0xf08080
#define COLOR_KHAKI 0xf0e68c
#define COLOR_ALICEBLUE 0xf0f8ff
#define COLOR_HONEYDEW 0xf0fff0
#define COLOR_AZURE 0xf0ffff
#define COLOR_SANDYBROWN 0xf4a460
#define COLOR_WHEAT 0xf5deb3
#define COLOR_BEIGE 0xf5f5dc
#define COLOR_WHITESMOKE 0xf5f5f5
#define COLOR_MINTCREAM 0xf5fffa
#define COLOR_GHOSTWHITE 0xf8f8ff
#define COLOR_SALMON 0xfa8072
#define COLOR_ANTIQUEWHITE 0xfaebd7
#define COLOR_LINEN 0xfaf0e6
#define COLOR_LIGHTGOLDENRODYELLOW 0xfafad2
#define COLOR_OLDLACE 0xfdf5e6
#define COLOR_RED 0xff0000
#define COLOR_FUCHSIA 0xff00ff
#define COLOR_MAGENTA 0xff00ff
#define COLOR_DEEPPINK 0xff1493
#define COLOR_ORANGERED 0xff4500
#define COLOR_TOMATO 0xff6347
#define COLOR_HOTPINK 0xff69b4
#define COLOR_CORAL 0xff7f50
#define COLOR_DARKORANGE 0xff8c00
#define COLOR_LIGHTSALMON 0xffa07a
#define COLOR_ORANGE 0xffa500
#define COLOR_LIGHTPINK 0xffb6c1
#define COLOR_PINK 0xffc0cb
#define COLOR_GOLD 0xffd700
#define COLOR_PEACHPUFF 0xffdab9
#define COLOR_NAVAJOWHITE 0xffdead
#define COLOR_MOCCASIN 0xffe4b5
#define COLOR_BISQUE 0xffe4c4
#define COLOR_MISTYROSE 0xffe4e1
#define COLOR_BLANCHEDALMOND 0xffebcd
#define COLOR_PAPAYAWHIP 0xffefd5
#define COLOR_LAVENDERBLUSH 0xfff0f5
#define COLOR_SEASHELL 0xfff5ee
#define COLOR_CORNSILK 0xfff8dc
#define COLOR_LEMONCHIFFON 0xfffacd
#define COLOR_FLORALWHITE 0xfffaf0
#define COLOR_SNOW 0xfffafa
#define COLOR_YELLOW 0xffff00
#define COLOR_LIGHTYELLOW 0xffffe0
#define COLOR_IVORY 0xfffff0
#define COLOR_WHITE 0xffffff
#endif // COLORS_H

1
OpenRGB.pro

@ -148,6 +148,7 @@ INCLUDEPATH +=
qt/
HEADERS += \
Colors.h \
dependencies/ColorWheel/ColorWheel.h \
dependencies/Swatches/swatches.h \
dependencies/json/json.hpp \

297
cli.cpp

@ -12,6 +12,7 @@
#include "NetworkClient.h"
#include "NetworkServer.h"
#include "LogManager.h"
#include "Colors.h"
/*-------------------------------------------------------------*\
| Quirk for MSVC; which doesn't support this case-insensitive |
@ -69,163 +70,161 @@ struct Options
ServerOptions servOpts;
};
/*---------------------------------------------------------------------------------------------------------*\
| Support a common subset of human colors; for easier typing: https://www.w3.org/TR/css-color-3/#svg-color |
\*---------------------------------------------------------------------------------------------------------*/
struct HumanColors { uint32_t rgb; const char* keyword; } static const human_colors[] =
{
{ 0x000000, "black" },
{ 0x000080, "navy" },
{ 0x00008b, "darkblue" },
{ 0x0000cd, "mediumblue" },
{ 0x0000ff, "blue" },
{ 0x006400, "darkgreen" },
{ 0x008000, "green" },
{ 0x008080, "teal" },
{ 0x008b8b, "darkcyan" },
{ 0x00bfff, "deepskyblue" },
{ 0x00ced1, "darkturquoise" },
{ 0x00fa9a, "mediumspringgreen" },
{ 0x00ff00, "lime" },
{ 0x00ff7f, "springgreen" },
{ 0x00ffff, "aqua" },
{ 0x00ffff, "cyan" },
{ 0x191970, "midnightblue" },
{ 0x1e90ff, "dodgerblue" },
{ 0x20b2aa, "lightseagreen" },
{ 0x228b22, "forestgreen" },
{ 0x2e8b57, "seagreen" },
{ 0x2f4f4f, "darkslategray" },
{ 0x2f4f4f, "darkslategrey" },
{ 0x32cd32, "limegreen" },
{ 0x3cb371, "mediumseagreen" },
{ 0x40e0d0, "turquoise" },
{ 0x4169e1, "royalblue" },
{ 0x4682b4, "steelblue" },
{ 0x483d8b, "darkslateblue" },
{ 0x48d1cc, "mediumturquoise" },
{ 0x4b0082, "indigo" },
{ 0x556b2f, "darkolivegreen" },
{ 0x5f9ea0, "cadetblue" },
{ 0x6495ed, "cornflowerblue" },
{ 0x66cdaa, "mediumaquamarine" },
{ 0x696969, "dimgray" },
{ 0x696969, "dimgrey" },
{ 0x6a5acd, "slateblue" },
{ 0x6b8e23, "olivedrab" },
{ 0x708090, "slategray" },
{ 0x708090, "slategrey" },
{ 0x778899, "lightslategray" },
{ 0x778899, "lightslategrey" },
{ 0x7b68ee, "mediumslateblue" },
{ 0x7cfc00, "lawngreen" },
{ 0x7fff00, "chartreuse" },
{ 0x7fffd4, "aquamarine" },
{ 0x800000, "maroon" },
{ 0x800080, "purple" },
{ 0x808000, "olive" },
{ 0x808080, "gray" },
{ 0x808080, "grey" },
{ 0x87ceeb, "skyblue" },
{ 0x87cefa, "lightskyblue" },
{ 0x8a2be2, "blueviolet" },
{ 0x8b0000, "darkred" },
{ 0x8b008b, "darkmagenta" },
{ 0x8b4513, "saddlebrown" },
{ 0x8fbc8f, "darkseagreen" },
{ 0x90ee90, "lightgreen" },
{ 0x9370db, "mediumpurple" },
{ 0x9400d3, "darkviolet" },
{ 0x98fb98, "palegreen" },
{ 0x9932cc, "darkorchid" },
{ 0x9acd32, "yellowgreen" },
{ 0xa0522d, "sienna" },
{ 0xa52a2a, "brown" },
{ 0xa9a9a9, "darkgray" },
{ 0xa9a9a9, "darkgrey" },
{ 0xadd8e6, "lightblue" },
{ 0xadff2f, "greenyellow" },
{ 0xafeeee, "paleturquoise" },
{ 0xb0c4de, "lightsteelblue" },
{ 0xb0e0e6, "powderblue" },
{ 0xb22222, "firebrick" },
{ 0xb8860b, "darkgoldenrod" },
{ 0xba55d3, "mediumorchid" },
{ 0xbc8f8f, "rosybrown" },
{ 0xbdb76b, "darkkhaki" },
{ 0xc0c0c0, "silver" },
{ 0xc71585, "mediumvioletred" },
{ 0xcd5c5c, "indianred" },
{ 0xcd853f, "peru" },
{ 0xd2691e, "chocolate" },
{ 0xd2b48c, "tan" },
{ 0xd3d3d3, "lightgray" },
{ 0xd3d3d3, "lightgrey" },
{ 0xd8bfd8, "thistle" },
{ 0xda70d6, "orchid" },
{ 0xdaa520, "goldenrod" },
{ 0xdb7093, "palevioletred" },
{ 0xdc143c, "crimson" },
{ 0xdcdcdc, "gainsboro" },
{ 0xdda0dd, "plum" },
{ 0xdeb887, "burlywood" },
{ 0xe0ffff, "lightcyan" },
{ 0xe6e6fa, "lavender" },
{ 0xe9967a, "darksalmon" },
{ 0xee82ee, "violet" },
{ 0xeee8aa, "palegoldenrod" },
{ 0xf08080, "lightcoral" },
{ 0xf0e68c, "khaki" },
{ 0xf0f8ff, "aliceblue" },
{ 0xf0fff0, "honeydew" },
{ 0xf0ffff, "azure" },
{ 0xf4a460, "sandybrown" },
{ 0xf5deb3, "wheat" },
{ 0xf5f5dc, "beige" },
{ 0xf5f5f5, "whitesmoke" },
{ 0xf5fffa, "mintcream" },
{ 0xf8f8ff, "ghostwhite" },
{ 0xfa8072, "salmon" },
{ 0xfaebd7, "antiquewhite" },
{ 0xfaf0e6, "linen" },
{ 0xfafad2, "lightgoldenrodyellow" },
{ 0xfdf5e6, "oldlace" },
{ 0xff0000, "red" },
{ 0xff00ff, "fuchsia" },
{ 0xff00ff, "magenta" },
{ 0xff1493, "deeppink" },
{ 0xff4500, "orangered" },
{ 0xff6347, "tomato" },
{ 0xff69b4, "hotpink" },
{ 0xff7f50, "coral" },
{ 0xff8c00, "darkorange" },
{ 0xffa07a, "lightsalmon" },
{ 0xffa500, "orange" },
{ 0xffb6c1, "lightpink" },
{ 0xffc0cb, "pink" },
{ 0xffd700, "gold" },
{ 0xffdab9, "peachpuff" },
{ 0xffdead, "navajowhite" },
{ 0xffe4b5, "moccasin" },
{ 0xffe4c4, "bisque" },
{ 0xffe4e1, "mistyrose" },
{ 0xffebcd, "blanchedalmond" },
{ 0xffefd5, "papayawhip" },
{ 0xfff0f5, "lavenderblush" },
{ 0xfff5ee, "seashell" },
{ 0xfff8dc, "cornsilk" },
{ 0xfffacd, "lemonchiffon" },
{ 0xfffaf0, "floralwhite" },
{ 0xfffafa, "snow" },
{ 0xffff00, "yellow" },
{ 0xffffe0, "lightyellow" },
{ 0xfffff0, "ivory" },
{ 0xffffff, "white" },
{ COLOR_BLACK, "black" },
{ COLOR_NAVY, "navy" },
{ COLOR_DARKBLUE, "darkblue" },
{ COLOR_MEDIUMBLUE, "mediumblue" },
{ COLOR_BLUE, "blue" },
{ COLOR_DARKGREEN, "darkgreen" },
{ COLOR_GREEN, "green" },
{ COLOR_TEAL, "teal" },
{ COLOR_DARKCYAN, "darkcyan" },
{ COLOR_DEEPSKYBLUE, "deepskyblue" },
{ COLOR_DARKTURQUOISE, "darkturquoise" },
{ COLOR_MEDIUMSPRINGGREEN, "mediumspringgreen" },
{ COLOR_LIME, "lime" },
{ COLOR_SPRINGGREEN, "springgreen" },
{ COLOR_AQUA, "aqua" },
{ COLOR_CYAN, "cyan" },
{ COLOR_MIDNIGHTBLUE, "midnightblue" },
{ COLOR_DODGERBLUE, "dodgerblue" },
{ COLOR_LIGHTSEAGREEN, "lightseagreen" },
{ COLOR_FORESTGREEN, "forestgreen" },
{ COLOR_SEAGREEN, "seagreen" },
{ COLOR_DARKSLATEGRAY, "darkslategray" },
{ COLOR_DARKSLATEGREY, "darkslategrey" },
{ COLOR_LIMEGREEN, "limegreen" },
{ COLOR_MEDIUMSEAGREEN, "mediumseagreen" },
{ COLOR_TURQUOISE, "turquoise" },
{ COLOR_ROYALBLUE, "royalblue" },
{ COLOR_STEELBLUE, "steelblue" },
{ COLOR_DARKSLATEBLUE, "darkslateblue" },
{ COLOR_MEDIUMTURQUOISE, "mediumturquoise" },
{ COLOR_INDIGO, "indigo" },
{ COLOR_DARKOLIVEGREEN, "darkolivegreen" },
{ COLOR_CADETBLUE, "cadetblue" },
{ COLOR_CORNFLOWERBLUE, "cornflowerblue" },
{ COLOR_MEDIUMAQUAMARINE, "mediumaquamarine" },
{ COLOR_DIMGRAY, "dimgray" },
{ COLOR_DIMGREY, "dimgrey" },
{ COLOR_SLATEBLUE, "slateblue" },
{ COLOR_OLIVEDRAB, "olivedrab" },
{ COLOR_SLATEGRAY, "slategray" },
{ COLOR_SLATEGREY, "slategrey" },
{ COLOR_LIGHTSLATEGRAY, "lightslategray" },
{ COLOR_LIGHTSLATEGREY, "lightslategrey" },
{ COLOR_MEDIUMSLATEBLUE, "mediumslateblue" },
{ COLOR_LAWNGREEN, "lawngreen" },
{ COLOR_CHARTREUSE, "chartreuse" },
{ COLOR_AQUAMARINE, "aquamarine" },
{ COLOR_MAROON, "maroon" },
{ COLOR_PURPLE, "purple" },
{ COLOR_OLIVE, "olive" },
{ COLOR_GRAY, "gray" },
{ COLOR_GREY, "grey" },
{ COLOR_SKYBLUE, "skyblue" },
{ COLOR_LIGHTSKYBLUE, "lightskyblue" },
{ COLOR_BLUEVIOLET, "blueviolet" },
{ COLOR_DARKRED, "darkred" },
{ COLOR_DARKMAGENTA, "darkmagenta" },
{ COLOR_SADDLEBROWN, "saddlebrown" },
{ COLOR_DARKSEAGREEN, "darkseagreen" },
{ COLOR_LIGHTGREEN, "lightgreen" },
{ COLOR_MEDIUMPURPLE, "mediumpurple" },
{ COLOR_DARKVIOLET, "darkviolet" },
{ COLOR_PALEGREEN, "palegreen" },
{ COLOR_DARKORCHID, "darkorchid" },
{ COLOR_YELLOWGREEN, "yellowgreen" },
{ COLOR_SIENNA, "sienna" },
{ COLOR_BROWN, "brown" },
{ COLOR_DARKGRAY, "darkgray" },
{ COLOR_DARKGREY, "darkgrey" },
{ COLOR_LIGHTBLUE, "lightblue" },
{ COLOR_GREENYELLOW, "greenyellow" },
{ COLOR_PALETURQUOISE, "paleturquoise" },
{ COLOR_LIGHTSTEELBLUE, "lightsteelblue" },
{ COLOR_POWDERBLUE, "powderblue" },
{ COLOR_FIREBRICK, "firebrick" },
{ COLOR_DARKGOLDENROD, "darkgoldenrod" },
{ COLOR_MEDIUMORCHID, "mediumorchid" },
{ COLOR_ROSYBROWN, "rosybrown" },
{ COLOR_DARKKHAKI, "darkkhaki" },
{ COLOR_SILVER, "silver" },
{ COLOR_MEDIUMVIOLETRED, "mediumvioletred" },
{ COLOR_INDIANRED, "indianred" },
{ COLOR_PERU, "peru" },
{ COLOR_CHOCOLATE, "chocolate" },
{ COLOR_TAN, "tan" },
{ COLOR_LIGHTGRAY, "lightgray" },
{ COLOR_LIGHTGREY, "lightgrey" },
{ COLOR_THISTLE, "thistle" },
{ COLOR_ORCHID, "orchid" },
{ COLOR_GOLDENROD, "goldenrod" },
{ COLOR_PALEVIOLETRED, "palevioletred" },
{ COLOR_CRIMSON, "crimson" },
{ COLOR_GAINSBORO, "gainsboro" },
{ COLOR_PLUM, "plum" },
{ COLOR_BURLYWOOD, "burlywood" },
{ COLOR_LIGHTCYAN, "lightcyan" },
{ COLOR_LAVENDER, "lavender" },
{ COLOR_DARKSALMON, "darksalmon" },
{ COLOR_VIOLET, "violet" },
{ COLOR_PALEGOLDENROD, "palegoldenrod" },
{ COLOR_LIGHTCORAL, "lightcoral" },
{ COLOR_KHAKI, "khaki" },
{ COLOR_ALICEBLUE, "aliceblue" },
{ COLOR_HONEYDEW, "honeydew" },
{ COLOR_AZURE, "azure" },
{ COLOR_SANDYBROWN, "sandybrown" },
{ COLOR_WHEAT, "wheat" },
{ COLOR_BEIGE, "beige" },
{ COLOR_WHITESMOKE, "whitesmoke" },
{ COLOR_MINTCREAM, "mintcream" },
{ COLOR_GHOSTWHITE, "ghostwhite" },
{ COLOR_SALMON, "salmon" },
{ COLOR_ANTIQUEWHITE, "antiquewhite" },
{ COLOR_LINEN, "linen" },
{ COLOR_LIGHTGOLDENRODYELLOW, "lightgoldenrodyellow" },
{ COLOR_OLDLACE, "oldlace" },
{ COLOR_RED, "red" },
{ COLOR_FUCHSIA, "fuchsia" },
{ COLOR_MAGENTA, "magenta" },
{ COLOR_DEEPPINK, "deeppink" },
{ COLOR_ORANGERED, "orangered" },
{ COLOR_TOMATO, "tomato" },
{ COLOR_HOTPINK, "hotpink" },
{ COLOR_CORAL, "coral" },
{ COLOR_DARKORANGE, "darkorange" },
{ COLOR_LIGHTSALMON, "lightsalmon" },
{ COLOR_ORANGE, "orange" },
{ COLOR_LIGHTPINK, "lightpink" },
{ COLOR_PINK, "pink" },
{ COLOR_GOLD, "gold" },
{ COLOR_PEACHPUFF, "peachpuff" },
{ COLOR_NAVAJOWHITE, "navajowhite" },
{ COLOR_MOCCASIN, "moccasin" },
{ COLOR_BISQUE, "bisque" },
{ COLOR_MISTYROSE, "mistyrose" },
{ COLOR_BLANCHEDALMOND, "blanchedalmond" },
{ COLOR_PAPAYAWHIP, "papayawhip" },
{ COLOR_LAVENDERBLUSH, "lavenderblush" },
{ COLOR_SEASHELL, "seashell" },
{ COLOR_CORNSILK, "cornsilk" },
{ COLOR_LEMONCHIFFON, "lemonchiffon" },
{ COLOR_FLORALWHITE, "floralwhite" },
{ COLOR_SNOW, "snow" },
{ COLOR_YELLOW, "yellow" },
{ COLOR_LIGHTYELLOW, "lightyellow" },
{ COLOR_IVORY, "ivory" },
{ COLOR_WHITE, "white" },
{ 0, NULL }
};
bool ParseColors(std::string colors_string, DeviceOptions *options)
{
while (colors_string.length() > 0)

Loading…
Cancel
Save