KiCad PCB EDA Suite
color4d.h File Reference
#include <wx/debug.h>
#include <nlohmann/json_fwd.hpp>

Go to the source code of this file.

Classes

struct  StructColors
 
class  KIGFX::COLOR4D
 A color representation with 4 components: red, green, blue, alpha. More...
 

Namespaces

namespace  KIGFX
 The Cairo implementation of the graphics abstraction layer.
 

Enumerations

enum  EDA_COLOR_T {
  UNSPECIFIED_COLOR = -1 , BLACK = 0 , DARKDARKGRAY , DARKGRAY ,
  LIGHTGRAY , WHITE , LIGHTYELLOW , DARKBLUE ,
  DARKGREEN , DARKCYAN , DARKRED , DARKMAGENTA ,
  DARKBROWN , BLUE , GREEN , CYAN ,
  RED , MAGENTA , BROWN , LIGHTBLUE ,
  LIGHTGREEN , LIGHTCYAN , LIGHTRED , LIGHTMAGENTA ,
  YELLOW , PUREBLUE , PUREGREEN , PURECYAN ,
  PURERED , PUREMAGENTA , PUREYELLOW , LIGHTERORANGE ,
  DARKORANGE , ORANGE , LIGHTORANGE , PUREORANGE ,
  NBCOLORS , HIGHLIGHT_FLAG = ( 1<<19 ) , MASKCOLOR = 31
}
 Legacy color enumeration. More...
 

Functions

const StructColorscolorRefs ()
 Global list of legacy color names, still used all over the place for constructing COLOR4D's. More...
 
const bool KIGFX::operator== (const COLOR4D &lhs, const COLOR4D &rhs)
 Equality operator, are two colors equal. More...
 
const bool KIGFX::operator!= (const COLOR4D &lhs, const COLOR4D &rhs)
 Not equality operator, are two colors not equal. More...
 
const bool KIGFX::operator< (const COLOR4D &lhs, const COLOR4D &rhs)
 
std::ostream & KIGFX::operator<< (std::ostream &aStream, COLOR4D const &aColor)
 Syntactic sugar for outputting colors to strings. More...
 
void KIGFX::to_json (nlohmann::json &aJson, const COLOR4D &aColor)
 
void KIGFX::from_json (const nlohmann::json &aJson, COLOR4D &aColor)
 

Enumeration Type Documentation

◆ EDA_COLOR_T

Legacy color enumeration.

Also contains a flag and the alpha value in the upper bits

Enumerator
UNSPECIFIED_COLOR 
BLACK 
DARKDARKGRAY 
DARKGRAY 
LIGHTGRAY 
WHITE 
LIGHTYELLOW 
DARKBLUE 
DARKGREEN 
DARKCYAN 
DARKRED 
DARKMAGENTA 
DARKBROWN 
BLUE 
GREEN 
CYAN 
RED 
MAGENTA 
BROWN 
LIGHTBLUE 
LIGHTGREEN 
LIGHTCYAN 
LIGHTRED 
LIGHTMAGENTA 
YELLOW 
PUREBLUE 
PUREGREEN 
PURECYAN 
PURERED 
PUREMAGENTA 
PUREYELLOW 
LIGHTERORANGE 
DARKORANGE 
ORANGE 
LIGHTORANGE 
PUREORANGE 
NBCOLORS 

Number of colors.

HIGHLIGHT_FLAG 
MASKCOLOR 

mask for color index into colorRefs()[]

Definition at line 41 of file color4d.h.

42{
44 BLACK = 0,
48 WHITE,
53 DARKRED,
56 BLUE,
57 GREEN,
58 CYAN,
59 RED,
60 MAGENTA,
61 BROWN,
67 YELLOW,
71 PURERED,
76 ORANGE,
79 NBCOLORS,
80 HIGHLIGHT_FLAG = ( 1<<19 ),
81 MASKCOLOR = 31
82};
@ HIGHLIGHT_FLAG
Definition: color4d.h:80
@ LIGHTGREEN
Definition: color4d.h:63
@ PUREORANGE
Definition: color4d.h:78
@ BROWN
Definition: color4d.h:61
@ PURECYAN
Definition: color4d.h:70
@ LIGHTBLUE
Definition: color4d.h:62
@ WHITE
Definition: color4d.h:48
@ LIGHTERORANGE
Definition: color4d.h:74
@ LIGHTORANGE
Definition: color4d.h:77
@ BLUE
Definition: color4d.h:56
@ LIGHTGRAY
Definition: color4d.h:47
@ DARKGRAY
Definition: color4d.h:46
@ MAGENTA
Definition: color4d.h:60
@ DARKORANGE
Definition: color4d.h:75
@ DARKMAGENTA
Definition: color4d.h:54
@ LIGHTYELLOW
Definition: color4d.h:49
@ DARKCYAN
Definition: color4d.h:52
@ NBCOLORS
Number of colors.
Definition: color4d.h:79
@ PURERED
Definition: color4d.h:71
@ UNSPECIFIED_COLOR
Definition: color4d.h:43
@ GREEN
Definition: color4d.h:57
@ CYAN
Definition: color4d.h:58
@ DARKRED
Definition: color4d.h:53
@ DARKBLUE
Definition: color4d.h:50
@ LIGHTCYAN
Definition: color4d.h:64
@ DARKDARKGRAY
Definition: color4d.h:45
@ ORANGE
Definition: color4d.h:76
@ PUREGREEN
Definition: color4d.h:69
@ LIGHTMAGENTA
Definition: color4d.h:66
@ PUREYELLOW
Definition: color4d.h:73
@ YELLOW
Definition: color4d.h:67
@ PUREBLUE
Definition: color4d.h:68
@ LIGHTRED
Definition: color4d.h:65
@ MASKCOLOR
mask for color index into colorRefs()[]
Definition: color4d.h:81
@ BLACK
Definition: color4d.h:44
@ DARKGREEN
Definition: color4d.h:51
@ PUREMAGENTA
Definition: color4d.h:72
@ RED
Definition: color4d.h:59
@ DARKBROWN
Definition: color4d.h:55

Function Documentation

◆ colorRefs()

const StructColors * colorRefs ( )

Global list of legacy color names, still used all over the place for constructing COLOR4D's.

Definition at line 39 of file color4d.cpp.

40{
41 static StructColors s_ColorRefs[NBCOLORS] =
42 {
43 { 0, 0, 0, BLACK, TS( "Black" ), DARKDARKGRAY },
44 { 72, 72, 72, DARKDARKGRAY, TS( "Gray 1" ), DARKGRAY },
45 { 132, 132, 132, DARKGRAY, TS( "Gray 2" ), LIGHTGRAY },
46 { 194, 194, 194, LIGHTGRAY, TS( "Gray 3" ), WHITE },
47 { 255, 255, 255, WHITE, TS( "White" ), WHITE },
48 { 194, 255, 255, LIGHTYELLOW, TS( "L.Yellow" ), WHITE },
49 { 191, 229, 255, LIGHTERORANGE, TS( "L.Orange" ), WHITE },
50 { 72, 0, 0, DARKBLUE, TS( "Blue 1" ), BLUE },
51 { 0, 72, 0, DARKGREEN, TS( "Green 1" ), GREEN },
52 { 72, 72, 0, DARKCYAN, TS( "Cyan 1" ), CYAN },
53 { 0, 0, 72, DARKRED, TS( "Red 1" ), RED },
54 { 72, 0, 72, DARKMAGENTA, TS( "Magenta 1" ), MAGENTA },
55 { 0, 72, 72, DARKBROWN, TS( "Brown 1" ), BROWN },
56 { 0, 77, 128, DARKORANGE, TS( "Orange 1" ), ORANGE },
57 { 132, 0, 0, BLUE, TS( "Blue 2" ), LIGHTBLUE },
58 { 0, 132, 0, GREEN, TS( "Green 2" ), LIGHTGREEN },
59 { 132, 132, 0, CYAN, TS( "Cyan 2" ), LIGHTCYAN },
60 { 0, 0, 132, RED, TS( "Red 2" ), LIGHTRED },
61 { 132, 0, 132, MAGENTA, TS( "Magenta 2" ), LIGHTMAGENTA },
62 { 0, 132, 132, BROWN, TS( "Brown 2" ), YELLOW },
63 { 0, 102, 204, ORANGE, TS( "Orange 2" ), LIGHTORANGE },
64 { 194, 0, 0, LIGHTBLUE, TS( "Blue 3" ), PUREBLUE, },
65 { 0, 194, 0, LIGHTGREEN, TS( "Green 3" ), PUREGREEN },
66 { 194, 194, 0, LIGHTCYAN, TS( "Cyan 3" ), PURECYAN },
67 { 0, 0, 194, LIGHTRED, TS( "Red 3" ), PURERED },
68 { 194, 0, 194, LIGHTMAGENTA, TS( "Magenta 3" ), PUREMAGENTA },
69 { 0, 194, 194, YELLOW, TS( "Yellow 3" ), PUREYELLOW },
70 { 0, 133, 221, LIGHTORANGE, TS( "Orange 3" ), PUREORANGE },
71 { 255, 0, 0, PUREBLUE, TS( "Blue 4" ), WHITE },
72 { 0, 255, 0, PUREGREEN, TS( "Green 4" ), WHITE },
73 { 255, 255, 0, PURECYAN, TS( "Cyan 4" ), WHITE },
74 { 0, 0, 255, PURERED, TS( "Red 4" ), WHITE },
75 { 255, 0, 255, PUREMAGENTA, TS( "Magenta 4" ), WHITE },
76 { 0, 255, 255, PUREYELLOW, TS( "Yellow 4" ), WHITE },
77 { 0, 153, 255, PUREORANGE, TS( "Orange 4" ), WHITE },
78 };
79 return s_ColorRefs;
80}
#define TS(string)
Definition: color4d.cpp:35

References BLACK, BLUE, BROWN, CYAN, DARKBLUE, DARKBROWN, DARKCYAN, DARKDARKGRAY, DARKGRAY, DARKGREEN, DARKMAGENTA, DARKORANGE, DARKRED, GREEN, LIGHTBLUE, LIGHTCYAN, LIGHTERORANGE, LIGHTGRAY, LIGHTGREEN, LIGHTMAGENTA, LIGHTORANGE, LIGHTRED, LIGHTYELLOW, MAGENTA, NBCOLORS, ORANGE, PUREBLUE, PURECYAN, PUREGREEN, PUREMAGENTA, PUREORANGE, PURERED, PUREYELLOW, RED, TS, WHITE, and YELLOW.

Referenced by KIGFX::COLOR4D::COLOR4D(), KIGFX::COLOR4D::FindNearestLegacyColor(), and DIALOG_COLOR_PICKER::initDefinedColors().