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

Go to the source code of this file.

Classes

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

Namespaces

 KIGFX
 Class CAIRO_GAL is 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, 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 
NBCOLORS 

Number of colors.

HIGHLIGHT_FLAG 
MASKCOLOR 

mask for color index into colorRefs()[]

Definition at line 41 of file color4d.h.

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

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 37 of file color4d.cpp.

38 {
39  static StructColors s_ColorRefs[NBCOLORS] =
40  {
41  { 0, 0, 0, BLACK, TS( "Black" ), DARKDARKGRAY },
42  { 72, 72, 72, DARKDARKGRAY, TS( "Gray 1" ), DARKGRAY },
43  { 132, 132, 132, DARKGRAY, TS( "Gray 2" ), LIGHTGRAY },
44  { 194, 194, 194, LIGHTGRAY, TS( "Gray 3" ), WHITE },
45  { 255, 255, 255, WHITE, TS( "White" ), WHITE },
46  { 194, 255, 255, LIGHTYELLOW, TS( "L.Yellow" ), WHITE },
47  { 72, 0, 0, DARKBLUE, TS( "Blue 1" ), BLUE },
48  { 0, 72, 0, DARKGREEN, TS( "Green 1" ), GREEN },
49  { 72, 72, 0, DARKCYAN, TS( "Cyan 1" ), CYAN },
50  { 0, 0, 72, DARKRED, TS( "Red 1" ), RED },
51  { 72, 0, 72, DARKMAGENTA, TS( "Magenta 1" ), MAGENTA },
52  { 0, 72, 72, DARKBROWN, TS( "Brown 1" ), BROWN },
53  { 132, 0, 0, BLUE, TS( "Blue 2" ), LIGHTBLUE },
54  { 0, 132, 0, GREEN, TS( "Green 2" ), LIGHTGREEN },
55  { 132, 132, 0, CYAN, TS( "Cyan 2" ), LIGHTCYAN },
56  { 0, 0, 132, RED, TS( "Red 2" ), LIGHTRED },
57  { 132, 0, 132, MAGENTA, TS( "Magenta 2" ), LIGHTMAGENTA },
58  { 0, 132, 132, BROWN, TS( "Brown 2" ), YELLOW },
59  { 194, 0, 0, LIGHTBLUE, TS( "Blue 3" ), PUREBLUE, },
60  { 0, 194, 0, LIGHTGREEN, TS( "Green 3" ), PUREGREEN },
61  { 194, 194, 0, LIGHTCYAN, TS( "Cyan 3" ), PURECYAN },
62  { 0, 0, 194, LIGHTRED, TS( "Red 3" ), PURERED },
63  { 194, 0, 194, LIGHTMAGENTA, TS( "Magenta 3" ), PUREMAGENTA },
64  { 0, 194, 194, YELLOW, TS( "Yellow 3" ), PUREYELLOW },
65  { 255, 0, 0, PUREBLUE, TS( "Blue 4" ), WHITE },
66  { 0, 255, 0, PUREGREEN, TS( "Green 4" ), WHITE },
67  { 255, 255, 0, PURECYAN, TS( "Cyan 4" ), WHITE },
68  { 0, 0, 255, PURERED, TS( "Red 4" ), WHITE },
69  { 255, 0, 255, PUREMAGENTA, TS( "Magenta 4" ), WHITE },
70  { 0, 255, 255, PUREYELLOW, TS( "Yellow 4" ), WHITE },
71  };
72  return s_ColorRefs;
73 }
Definition: color4d.h:61
Definition: color4d.h:44
Number of colors.
Definition: color4d.h:74
Definition: color4d.h:67
Definition: color4d.h:57
Definition: color4d.h:58
Definition: color4d.h:59
Definition: color4d.h:48
Definition: color4d.h:56
#define TS(string)
Definition: color4d.cpp:33

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

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