From 0dc88bb4cf0a6ce5525b86d764e747ff9ac71ed6 Mon Sep 17 00:00:00 2001
From: Maciej Suminski <maciej.suminski@cern.ch>
Date: Mon, 20 Feb 2017 18:48:27 +0100
Subject: [PATCH] Changed COLOR4D defines to static consts

---
 3d-viewer/3d_canvas/create_layer_items.cpp    |  2 +-
 common/class_colors_design_settings.cpp       |  4 ++--
 common/common_plotDXF_functions.cpp           |  8 ++++----
 common/common_plotPS_functions.cpp            |  2 +-
 common/common_plot_functions.cpp              |  2 +-
 common/config_params.cpp                      |  2 +-
 common/eda_text.cpp                           |  4 ++--
 common/gal/color4d.cpp                        | 20 ++++++++++++-------
 common/gr_basic.cpp                           | 12 +++++------
 .../page_layout/page_layout_graphic_items.cpp | 10 +++++-----
 common/selcolor.cpp                           |  2 +-
 eeschema/class_libentry.cpp                   |  4 ++--
 eeschema/class_sch_screen.h                   |  2 +-
 eeschema/dialogs/dialog_lib_edit_pin.cpp      |  2 +-
 eeschema/eeschema.cpp                         |  2 +-
 eeschema/lib_arc.cpp                          |  4 ++--
 eeschema/lib_bezier.cpp                       |  4 ++--
 eeschema/lib_circle.cpp                       |  4 ++--
 eeschema/lib_draw_item.h                      |  4 ++--
 eeschema/lib_field.cpp                        |  8 ++++----
 eeschema/lib_pin.cpp                          | 10 +++++-----
 eeschema/lib_pin.h                            |  4 ++--
 eeschema/lib_polyline.cpp                     |  4 ++--
 eeschema/lib_rectangle.cpp                    |  4 ++--
 eeschema/lib_text.cpp                         |  4 ++--
 eeschema/libeditframe.cpp                     |  8 ++++----
 eeschema/pinedit.cpp                          |  6 +++---
 eeschema/sch_bitmap.cpp                       |  2 +-
 eeschema/sch_bitmap.h                         |  2 +-
 eeschema/sch_bus_entry.cpp                    |  2 +-
 eeschema/sch_bus_entry.h                      |  2 +-
 eeschema/sch_component.h                      |  4 ++--
 eeschema/sch_field.h                          |  2 +-
 eeschema/sch_item_struct.h                    |  4 ++--
 eeschema/sch_junction.cpp                     |  2 +-
 eeschema/sch_junction.h                       |  2 +-
 eeschema/sch_line.cpp                         |  2 +-
 eeschema/sch_line.h                           |  2 +-
 eeschema/sch_marker.cpp                       |  2 +-
 eeschema/sch_marker.h                         |  2 +-
 eeschema/sch_no_connect.cpp                   |  2 +-
 eeschema/sch_no_connect.h                     |  2 +-
 eeschema/sch_sheet.cpp                        |  8 ++++----
 eeschema/sch_sheet.h                          |  4 ++--
 eeschema/sch_text.cpp                         | 12 +++++------
 eeschema/sch_text.h                           |  8 ++++----
 eeschema/schedit.cpp                          |  4 ++--
 eeschema/symbdraw.cpp                         |  8 ++++----
 .../widgets/widget_eeschema_color_config.cpp  |  4 ++--
 gerbview/class_gbr_display_options.h          |  2 +-
 gerbview/class_gerbview_layer_widget.cpp      |  2 +-
 gerbview/gerbview_frame.cpp                   |  2 +-
 include/class_drawpanel.h                     |  2 +-
 include/eda_text.h                            |  4 ++--
 include/gal/color4d.h                         | 17 ++++++++--------
 include/msgpanel.h                            |  2 +-
 include/plot_common.h                         |  2 +-
 include/worksheet_shape_builder.h             | 18 ++++++++---------
 pcbnew/autorouter/auto_place_footprints.cpp   |  4 ++--
 pcbnew/autorouter/autorout.cpp                |  4 ++--
 ...board_items_to_polygon_shape_transform.cpp |  2 +-
 pcbnew/class_board.cpp                        |  2 +-
 pcbnew/class_pad_draw_functions.cpp           |  2 +-
 pcbnew/class_pcb_layer_widget.cpp             | 16 +++++++--------
 pcbnew/class_pcb_text.cpp                     |  2 +-
 pcbnew/dialogs/dialog_SVG_print.cpp           |  2 +-
 pcbnew/dialogs/dialog_pad_properties.cpp      |  2 +-
 pcbnew/exporters/export_vrml.cpp              |  2 +-
 pcbnew/exporters/gen_drill_report_files.cpp   |  4 ++--
 pcbnew/layer_widget.cpp                       | 14 ++++++-------
 pcbnew/layer_widget.h                         |  4 ++--
 pcbnew/plot_board_layers.cpp                  |  6 +++---
 pcbnew/plot_brditems_plotter.cpp              | 12 +++++------
 pcbnew/print_board_functions.cpp              |  2 +-
 74 files changed, 180 insertions(+), 175 deletions(-)

diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp
index 361e8f3716..39b5e57343 100644
--- a/3d-viewer/3d_canvas/create_layer_items.cpp
+++ b/3d-viewer/3d_canvas/create_layer_items.cpp
@@ -106,7 +106,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
     s_boardBBox3DU = &m_board2dBBox3DU;
 
     // not actually used, but needed by DrawGraphicText
-    const COLOR4D dummy_color = COLOR4D_BLACK;
+    const COLOR4D dummy_color = COLOR4D::BLACK;
 
     if( aTextPCB->IsMultilineAllowed() )
     {
diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp
index 8b72a32df3..3e996da800 100644
--- a/common/class_colors_design_settings.cpp
+++ b/common/class_colors_design_settings.cpp
@@ -112,7 +112,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
     {
         return m_LayersColors[aLayer];
     }
-    return UNSPECIFIED_COLOR4D;
+    return COLOR4D::UNSPECIFIED;
 }
 
 
@@ -132,7 +132,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
         return m_ItemsColors[aItemIdx];
     }
 
-    return UNSPECIFIED_COLOR4D;
+    return COLOR4D::UNSPECIFIED;
 }
 
 
diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp
index e6be16fb34..088da297d7 100644
--- a/common/common_plotDXF_functions.cpp
+++ b/common/common_plotDXF_functions.cpp
@@ -69,7 +69,7 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
 
     SetDefaultLineWidth( 0 );               // No line width on DXF
     m_plotMirror = false;                     // No mirroring on DXF
-    m_currentColor = COLOR4D_BLACK;
+    m_currentColor = COLOR4D::BLACK;
 }
 
 /**
@@ -280,13 +280,13 @@ void DXF_PLOTTER::SetColor( COLOR4D color )
 {
     wxASSERT( outputFile );
     if( ( colorMode )
-       || ( color == COLOR4D_BLACK )
-       || ( color == COLOR4D_WHITE ) )
+       || ( color == COLOR4D::BLACK )
+       || ( color == COLOR4D::WHITE ) )
     {
         m_currentColor = color;
     }
     else
-        m_currentColor = COLOR4D_BLACK;
+        m_currentColor = COLOR4D::BLACK;
 }
 
 /**
diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp
index 316b1954ca..f32ff3b1ac 100644
--- a/common/common_plotPS_functions.cpp
+++ b/common/common_plotPS_functions.cpp
@@ -72,7 +72,7 @@ void PSLIKE_PLOTTER::SetColor( COLOR4D color )
          * holes in white on pads in black
          */
         double k = 1; // White
-        if( color != COLOR4D_WHITE )
+        if( color != COLOR4D::WHITE )
             k = 0;
         if( negativeMode )
             emitSetRGBColor( 1 - k, 1 - k, 1 - k );
diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp
index 2a171bde89..98adc52e9b 100644
--- a/common/common_plot_functions.cpp
+++ b/common/common_plot_functions.cpp
@@ -79,7 +79,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
      */
     double   iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
 
-    COLOR4D plotColor = plotter->GetColorMode() ? COLOR4D( RED ) : COLOR4D_BLACK;
+    COLOR4D plotColor = plotter->GetColorMode() ? COLOR4D( RED ) : COLOR4D::BLACK;
     plotter->SetColor( plotColor );
     WS_DRAW_ITEM_LIST drawList;
 
diff --git a/common/config_params.cpp b/common/config_params.cpp
index 9f91d743e7..0d56708b97 100644
--- a/common/config_params.cpp
+++ b/common/config_params.cpp
@@ -273,7 +273,7 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
 
     // First try reading old format
     EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT( "NONE" ) ) );
-    COLOR4D wtmp = UNSPECIFIED_COLOR4D;
+    COLOR4D wtmp = COLOR4D::UNSPECIFIED;
 
     if( itmp == UNSPECIFIED_COLOR )
     {
diff --git a/common/eda_text.cpp b/common/eda_text.cpp
index 874fc74f4d..48d405a610 100644
--- a/common/eda_text.cpp
+++ b/common/eda_text.cpp
@@ -314,7 +314,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
                            aDrawMode, aFillMode, GetShownText(), GetTextPos() );
 
     // Draw text anchor, if requested
-    if( aAnchor_color != UNSPECIFIED_COLOR4D )
+    if( aAnchor_color != COLOR4D::UNSPECIFIED )
     {
         GRDrawAnchor( aClipBox, aDC,
                       GetTextPos().x + aOffset.x, GetTextPos().y + aOffset.y,
@@ -511,7 +511,7 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
         size.x = -size.x;
 
     s_cornerBuffer = &aCornerBuffer;
-    COLOR4D color = COLOR4D_BLACK;  // not actually used, but needed by DrawGraphicText
+    COLOR4D color = COLOR4D::BLACK;  // not actually used, but needed by DrawGraphicText
 
     if( IsMultilineAllowed() )
     {
diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp
index 0ea4f3a1e6..0b717364a2 100644
--- a/common/gal/color4d.cpp
+++ b/common/gal/color4d.cpp
@@ -81,10 +81,10 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
         static std::map< std::pair< uint32_t, uint32_t >, uint32_t > mix_cache;
 
         // First easy thing: a black gives always the other colour
-        if( *this == COLOR4D_BLACK )
+        if( *this == COLOR4D::BLACK )
             return aColor;
 
-        if( aColor == COLOR4D_BLACK )
+        if( aColor == COLOR4D::BLACK )
             return *this;
 
         uint32_t myPackedColor = ToU32();
@@ -95,11 +95,11 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
          * an answer */
         auto search = mix_cache.find( std::pair< uint32_t, uint32_t >( myPackedColor,
                                                                        aPackedColor ) );
-        COLOR4D candidate = COLOR4D_BLACK;
+        COLOR4D candidate = COLOR4D::BLACK;
         if( search != mix_cache.end() )
             candidate.FromU32( search->second );
 
-        if( candidate != COLOR4D_BLACK )
+        if( candidate != COLOR4D::BLACK )
             return candidate;
 
         // Blend the two colors (i.e. OR the RGB values)
@@ -112,7 +112,7 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
         /* Here, BLACK is *not* a good answer, since it would recompute the next time.
          * Even theorically its not possible (with the current rules), but
          * maybe the metric will change in the future */
-        if( candidate == COLOR4D_BLACK )
+        if( candidate == COLOR4D::BLACK )
             candidate = COLOR4D( DARKDARKGRAY );
 
         // Store the result in the cache. The operation is commutative, too
@@ -214,7 +214,8 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
         }
         else
         {
-            for( EDA_COLOR_T candidate = BLACK; candidate < NBCOLORS; candidate = NextColor(candidate) )
+            for( EDA_COLOR_T candidate = ::BLACK;
+                    candidate < NBCOLORS; candidate = NextColor( candidate ) )
             {
                 double ch, cs, cv;
 
@@ -245,7 +246,8 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
 
         // Now we have the desired hue; let's find the nearest value
         minDist = 1.0;
-        for( EDA_COLOR_T candidate = BLACK; candidate < NBCOLORS; candidate = NextColor(candidate) )
+        for( EDA_COLOR_T candidate = ::BLACK;
+                candidate < NBCOLORS; candidate = NextColor( candidate ) )
         {
             // If the target hue is NAN, we didn't extract the value for any colors above
             if( std::isnan( legacyHue ) )
@@ -407,3 +409,7 @@ COLOR4D& COLOR4D::Saturate( double aFactor )
 
     return *this;
 }
+
+const COLOR4D COLOR4D::UNSPECIFIED( 0, 0, 0, 0 );
+const COLOR4D COLOR4D::WHITE( 1, 1, 1, 1 );
+const COLOR4D COLOR4D::BLACK( 0, 0, 0, 1 );
diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp
index 4f69c42abf..9c1e0ab6c2 100644
--- a/common/gr_basic.cpp
+++ b/common/gr_basic.cpp
@@ -196,8 +196,8 @@ static void WinClipAndDrawLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int
 void GRResetPenAndBrush( wxDC* DC )
 {
     GRSetBrush( DC, BLACK );  // Force no fill
-    s_DC_lastbrushcolor = UNSPECIFIED_COLOR4D;
-    s_DC_lastcolor =  UNSPECIFIED_COLOR4D;
+    s_DC_lastbrushcolor = COLOR4D::UNSPECIFIED;
+    s_DC_lastcolor =  COLOR4D::UNSPECIFIED;
     s_DC_lastDC    = NULL;
 }
 
@@ -214,7 +214,7 @@ void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
         width = DC->DeviceToLogicalXRel( 1 );
 
     if( s_ForceBlackPen )
-        Color = COLOR4D_BLACK;
+        Color = COLOR4D::BLACK;
 
     const wxPen& curr_pen = DC->GetPen();
 
@@ -240,7 +240,7 @@ void GRSetColorPen( wxDC* DC, COLOR4D Color, int width, wxPenStyle style )
 void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill )
 {
     if( s_ForceBlackPen )
-        Color = COLOR4D_BLACK;
+        Color = COLOR4D::BLACK;
 
     if(   s_DC_lastbrushcolor != Color
        || s_DC_lastbrushfill  != fill
@@ -377,10 +377,10 @@ void GRDashedLine( EDA_RECT* ClipBox, wxDC*     DC,
 {
     GRLastMoveToX  = x2;
     GRLastMoveToY  = y2;
-    s_DC_lastcolor = UNSPECIFIED_COLOR4D;
+    s_DC_lastcolor = COLOR4D::UNSPECIFIED;
     GRSetColorPen( DC, Color, width, wxPENSTYLE_SHORT_DASH );
     WinClipAndDrawLine( ClipBox, DC, x1, y1, x2, y2, width );
-    s_DC_lastcolor = UNSPECIFIED_COLOR4D;
+    s_DC_lastcolor = COLOR4D::UNSPECIFIED;
     GRSetColorPen( DC, Color, width );
 }
 
diff --git a/common/page_layout/page_layout_graphic_items.cpp b/common/page_layout/page_layout_graphic_items.cpp
index eaa5734de6..75023fa0ea 100644
--- a/common/page_layout/page_layout_graphic_items.cpp
+++ b/common/page_layout/page_layout_graphic_items.cpp
@@ -191,9 +191,9 @@ void WS_DRAW_ITEM_TEXT::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint
        GR_DRAWMODE aDrawMode, COLOR4D aColor )
 {
     Draw( aClipBox, aDC, aOffset,
-            aColor == UNSPECIFIED_COLOR4D ? GetColor() : aColor,
+            aColor == COLOR4D::UNSPECIFIED ? GetColor() : aColor,
             aDrawMode == UNSPECIFIED_DRAWMODE ? GR_COPY : aDrawMode,
-            FILLED, UNSPECIFIED_COLOR4D );
+            FILLED, COLOR4D::UNSPECIFIED );
 }
 
 
@@ -238,7 +238,7 @@ void WS_DRAW_ITEM_POLYGON::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPo
         points = &m_Corners[0];
     }
 
-    auto color = ( aColor == UNSPECIFIED_COLOR4D ) ? GetColor() : aColor;
+    auto color = ( aColor == COLOR4D::UNSPECIFIED ) ? GetColor() : aColor;
 
     GRSetDrawMode( aDC, ( aDrawMode == UNSPECIFIED_DRAWMODE ? GR_COPY : aDrawMode ) );
     GRPoly( aClipBox, aDC,
@@ -295,7 +295,7 @@ void WS_DRAW_ITEM_RECT::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint
             GetStart().x + aOffset.x, GetStart().y + aOffset.y,
             GetEnd().x + aOffset.x, GetEnd().y + aOffset.y,
             GetPenWidth(),
-            ( aColor == UNSPECIFIED_COLOR4D ) ? GetColor() : aColor );
+            ( aColor == COLOR4D::UNSPECIFIED ) ? GetColor() : aColor );
     GRSetDrawMode( aDC, GR_COPY );
 }
 
@@ -398,7 +398,7 @@ void WS_DRAW_ITEM_LINE::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint
     GRSetDrawMode( aDC, ( aDrawMode == UNSPECIFIED_DRAWMODE ) ? GR_COPY : aDrawMode );
     GRLine( aClipBox, aDC, GetStart() + aOffset, GetEnd() + aOffset,
             GetPenWidth(),
-            ( aColor == UNSPECIFIED_COLOR4D ) ? GetColor() : aColor );
+            ( aColor == COLOR4D::UNSPECIFIED ) ? GetColor() : aColor );
     GRSetDrawMode( aDC, GR_COPY );
 }
 
diff --git a/common/selcolor.cpp b/common/selcolor.cpp
index 7bc63349bd..e859353fbb 100644
--- a/common/selcolor.cpp
+++ b/common/selcolor.cpp
@@ -77,7 +77,7 @@ COLOR4D DisplayColorFrame( wxWindow* aParent, COLOR4D aOldColor )
         return dlg.GetSelectedColor();
     }
 
-    return UNSPECIFIED_COLOR4D;
+    return COLOR4D::UNSPECIFIED;
 }
 
 
diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
index 99647479ca..9e7a1b244a 100644
--- a/eeschema/class_libentry.cpp
+++ b/eeschema/class_libentry.cpp
@@ -327,7 +327,7 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
      *   If the color is not the default color (aColor != -1 )
      */
     if( ! ( screen && screen->m_IsPrinting && GetGRForceBlackPenState() )
-            && ( aOpts.color == UNSPECIFIED_COLOR4D ) )
+            && ( aOpts.color == COLOR4D::UNSPECIFIED ) )
     {
         for( LIB_ITEM& drawItem : drawings )
         {
@@ -560,7 +560,7 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD
         if( *i == aItem )
         {
             if( aDc != NULL )
-                aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D,
+                aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED,
                              g_XorMode, NULL, DefaultTransform );
 
             drawings.erase( i );
diff --git a/eeschema/class_sch_screen.h b/eeschema/class_sch_screen.h
index 74271cddd0..efb382b351 100644
--- a/eeschema/class_sch_screen.h
+++ b/eeschema/class_sch_screen.h
@@ -218,7 +218,7 @@ public:
      * @param aColor The drawing color.
      */
     void Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode,
-               COLOR4D aColor = UNSPECIFIED_COLOR4D );
+               COLOR4D aColor = COLOR4D::UNSPECIFIED );
 
     /**
      * Function Plot
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index 103f472781..432d4b43ef 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -104,7 +104,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
     // This is a flag for m_dummyPin->Draw
     uintptr_t flags = uintptr_t( PIN_DRAW_TEXTS | PIN_DRAW_DANGLING );
 
-    m_dummyPin->Draw( NULL, &dc, offset, UNSPECIFIED_COLOR4D, GR_COPY,
+    m_dummyPin->Draw( NULL, &dc, offset, COLOR4D::UNSPECIFIED, GR_COPY,
                       (void*)flags, DefaultTransform );
 
     m_dummyPin->SetParent(NULL);
diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp
index 9280368372..d0141cf057 100644
--- a/eeschema/eeschema.cpp
+++ b/eeschema/eeschema.cpp
@@ -233,7 +233,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
     for( LAYERSCH_ID ii = LAYER_FIRST; ii < LAYERSCH_ID_COUNT; ++ii )
         SetLayerColor( COLOR4D( DARKGRAY ), ii );
 
-    SetLayerColor( COLOR4D_WHITE, LAYER_BACKGROUND );
+    SetLayerColor( COLOR4D::WHITE, LAYER_BACKGROUND );
 
     // Must be called before creating the main frame in order to
     // display the real hotkeys in menus or tool tips
diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp
index 7846331495..263ad17734 100644
--- a/eeschema/lib_arc.cpp
+++ b/eeschema/lib_arc.cpp
@@ -421,7 +421,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
     wxPoint pos1, pos2, posc;
     COLOR4D color = GetLayerColor( LAYER_DEVICE );
 
-    if( aColor == UNSPECIFIED_COLOR4D )       // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )       // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
@@ -448,7 +448,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
 
     FILL_T fill = aData ? NO_FILL : m_Fill;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         fill = NO_FILL;
 
     EDA_RECT* const clipbox  = aPanel? aPanel->GetClipBox() : NULL;
diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp
index 5a0130f299..a1b81d8da2 100644
--- a/eeschema/lib_bezier.cpp
+++ b/eeschema/lib_bezier.cpp
@@ -303,7 +303,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
         PolyPointsTraslated.push_back( aTransform.TransformCoordinate( m_PolyPoints[i] ) +
                                        aOffset );
 
-    if( aColor == UNSPECIFIED_COLOR4D )                // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )                // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
@@ -315,7 +315,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
 
     FILL_T fill = aData ? NO_FILL : m_Fill;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         fill = NO_FILL;
 
     GRSetDrawMode( aDC, aDrawMode );
diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp
index afbebe4bb4..78a915325c 100644
--- a/eeschema/lib_circle.cpp
+++ b/eeschema/lib_circle.cpp
@@ -215,7 +215,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
 
     COLOR4D color = GetLayerColor( LAYER_DEVICE );
 
-    if( aColor == UNSPECIFIED_COLOR4D )       // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )       // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
@@ -229,7 +229,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
     GRSetDrawMode( aDC, aDrawMode );
 
     FILL_T fill = aData ? NO_FILL : m_Fill;
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         fill = NO_FILL;
 
     EDA_RECT* const clipbox  = aPanel? aPanel->GetClipBox() : NULL;
diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h
index da6721a922..63b2ab7677 100644
--- a/eeschema/lib_draw_item.h
+++ b/eeschema/lib_draw_item.h
@@ -84,7 +84,7 @@ class LIB_ITEM : public EDA_ITEM
      * @param aDC A pointer to the device context used to draw the object.
      * @param aOffset A reference to a wxPoint object containing the offset where to draw
      *                from the object's current position.
-     * @param aColor A COLOR4D to draw the object or UNSPECIFIED_COLOR4D to draw
+     * @param aColor A COLOR4D to draw the object or COLOR4D::UNSPECIFIED to draw
      *               the object in it's default color.
      * @param aDrawMode The mode used to perform the draw (#GR_OR, #GR_COPY, etc.).
      * @param aData A pointer to any object specific data required to perform the draw.
@@ -207,7 +207,7 @@ public:
      * @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
      * @param aDC Device Context (can be null)
      * @param aOffset Offset to draw
-     * @param aColor Draw color, or UNSPECIFIED_COLOR4D to use the normal body item color
+     * @param aColor Draw color, or COLOR4D::UNSPECIFIED to use the normal body item color
      * @param aDrawMode GR_OR, GR_XOR, ...
      * @param aData Value or pointer used to pass others parameters, depending on body items.
      *              Used for some items to force to force no fill mode ( has meaning only for
diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp
index 21f7264811..ca38d72377 100644
--- a/eeschema/lib_field.cpp
+++ b/eeschema/lib_field.cpp
@@ -291,7 +291,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
                              const TRANSFORM& aTransform )
 {
     wxPoint  text_pos;
-    COLOR4D color = UNSPECIFIED_COLOR4D;
+    COLOR4D color = COLOR4D::UNSPECIFIED;
     int      linewidth = GetPenSize();
 
     if( IsBold() )
@@ -299,11 +299,11 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
     else
         linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
 
-    if( !IsVisible() && ( aColor == UNSPECIFIED_COLOR4D ) )
+    if( !IsVisible() && ( aColor == COLOR4D::UNSPECIFIED ) )
     {
         color = GetInvisibleItemColor();
     }
-    else if( IsSelected() && ( aColor == UNSPECIFIED_COLOR4D ) )
+    else if( IsSelected() && ( aColor == COLOR4D::UNSPECIFIED ) )
     {
         color = GetItemSelectedColor();
     }
@@ -312,7 +312,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
         color = aColor;
     }
 
-    if( color == UNSPECIFIED_COLOR4D )
+    if( color == COLOR4D::UNSPECIFIED )
         color = GetDefaultColor();
 
     text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 03171b1d34..6a7cd337b7 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -993,7 +993,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
 
     COLOR4D color = GetLayerColor( LAYER_PIN );
 
-    if( aColor == UNSPECIFIED_COLOR4D )       // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )       // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
@@ -1210,12 +1210,12 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
     EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
 
     /* Get the num and name colors */
-    if( ( Color == UNSPECIFIED_COLOR4D ) && IsSelected() )
+    if( ( Color == COLOR4D::UNSPECIFIED ) && IsSelected() )
         Color = GetItemSelectedColor();
 
-    COLOR4D NameColor = Color == UNSPECIFIED_COLOR4D ?
+    COLOR4D NameColor = Color == COLOR4D::UNSPECIFIED ?
                             GetLayerColor( LAYER_PINNAM ) : Color;
-    COLOR4D NumColor  = Color == UNSPECIFIED_COLOR4D ?
+    COLOR4D NumColor  = Color == COLOR4D::UNSPECIFIED ?
                             GetLayerColor( LAYER_PINNUM ) : Color;
 
     /* Create the pin num string */
@@ -1411,7 +1411,7 @@ void LIB_PIN::DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
     int pensize = etextSize/6;
 
     // Get a suitable color
-    if( ( aColor == UNSPECIFIED_COLOR4D ) && IsSelected() )
+    if( ( aColor == COLOR4D::UNSPECIFIED ) && IsSelected() )
         aColor = GetItemSelectedColor();
     else if( !IsVisible() )
         aColor = GetInvisibleItemColor();
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 4f871e047c..edd365639e 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -85,7 +85,7 @@ class LIB_PIN : public LIB_ITEM
      * @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
      * @param aDC Device Context (can be null)
      * @param aOffset Offset to draw
-     * @param aColor UNSPECIFIED_COLOR4D to use the normal body item color, or else use this color
+     * @param aColor COLOR4D::UNSPECIFIED to use the normal body item color, or else use this color
      * @param aDrawMode GR_OR, GR_XOR, ...
      * @param aData = used here as uintptr_t containing bitwise OR'd flags:
      *      PIN_DRAW_TEXTS,     -- false to draw only pin shape, useful for fast mode
@@ -385,7 +385,7 @@ public:
      */
     void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                         int aOrientation, GR_DRAWMODE aDrawMode,
-                        COLOR4D aColor = UNSPECIFIED_COLOR4D,
+                        COLOR4D aColor = COLOR4D::UNSPECIFIED,
                         bool aDrawDangling = true,
                         bool aOnlyTarget = false );
 
diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp
index 78a3fe9b60..cab382b4d2 100644
--- a/eeschema/lib_polyline.cpp
+++ b/eeschema/lib_polyline.cpp
@@ -270,7 +270,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
     COLOR4D color = GetLayerColor( LAYER_DEVICE );
     wxPoint* buffer = NULL;
 
-    if( aColor == UNSPECIFIED_COLOR4D )                // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )                // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
@@ -289,7 +289,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
 
     FILL_T fill = aData ? NO_FILL : m_Fill;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         fill = NO_FILL;
 
     GRSetDrawMode( aDC, aDrawMode );
diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp
index 6568bbb53f..a0314f81c5 100644
--- a/eeschema/lib_rectangle.cpp
+++ b/eeschema/lib_rectangle.cpp
@@ -203,7 +203,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
 
     COLOR4D color = GetLayerColor( LAYER_DEVICE );
 
-    if( aColor == UNSPECIFIED_COLOR4D )       // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )       // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
@@ -218,7 +218,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
 
     FILL_T fill = aData ? NO_FILL : m_Fill;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         fill = NO_FILL;
 
     GRSetDrawMode( aDC, aDrawMode );
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index 7d237fa173..245525a63c 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -339,7 +339,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
     if( plotter->GetColorMode() )       // Used normal color or selected color
         color = IsSelected() ? GetItemSelectedColor() : GetDefaultColor();
     else
-        color = COLOR4D_BLACK;
+        color = COLOR4D::BLACK;
 
     plotter->Text( pos, color, GetShownText(),
                    t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
@@ -372,7 +372,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
 {
     COLOR4D color = GetDefaultColor();
 
-    if( aColor == UNSPECIFIED_COLOR4D )       // Used normal color or selected color
+    if( aColor == COLOR4D::UNSPECIFIED )       // Used normal color or selected color
     {
         if( IsSelected() )
             color = GetItemSelectedColor();
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index da8aeb36a6..e2002458ae 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -801,10 +801,10 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
             m_canvas->MoveCursorToCrossHair();
             STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
             m_drawItem->ClearFlags();
-            m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
+            m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
                               DefaultTransform );
             ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetCrossHairPosition( true ) );
-            m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
+            m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
                               DefaultTransform );
             m_drawItem->SetFlags( oldFlags );
             m_lastDrawItem = NULL;
@@ -1048,7 +1048,7 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
 
     // Deleting old text
     if( DC && !DrawItem->InEditMode() )
-        DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
+        DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
                         DefaultTransform );
 
     DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
@@ -1058,7 +1058,7 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
 
     // Display new text
     if( DC && !DrawItem->InEditMode() )
-        DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, GR_DEFAULT_DRAWMODE, NULL,
+        DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_DEFAULT_DRAWMODE, NULL,
                         DefaultTransform );
 }
 
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index 3eb01d38a1..1f40a39cfe 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -400,13 +400,13 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
     if( aErase )
     {
         cur_pin->Move( PinPreviousPos );
-        cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode,
+        cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode,
                           showOptions, DefaultTransform );
     }
 
     // Redraw pin in new position
     cur_pin->Move( aPanel->GetParent()->GetCrossHairPosition( true ) );
-    cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode,
+    cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode,
                    showOptions, DefaultTransform );
 
     PinPreviousPos = cur_pin->GetPosition();
@@ -480,7 +480,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
             // Build it:
             void* showOptions = reinterpret_cast<void*>( show_opts );
 
-            pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, GR_COPY,
+            pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, GR_COPY,
                        showOptions, DefaultTransform );
         }
 
diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp
index 66abba1474..25da8498ad 100644
--- a/eeschema/sch_bitmap.cpp
+++ b/eeschema/sch_bitmap.cpp
@@ -195,7 +195,7 @@ void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
 {
     wxPoint pos = m_pos + aOffset;
 
-    if( aColor == UNSPECIFIED_COLOR4D )    // Use normal drawing function
+    if( aColor == COLOR4D::UNSPECIFIED )    // Use normal drawing function
     {
         // https://bugs.launchpad.net/kicad/+bug/1529163
         // "Moving images in eeschema on OS X uses
diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h
index d6765747d1..a3eef7573c 100644
--- a/eeschema/sch_bitmap.h
+++ b/eeschema/sch_bitmap.h
@@ -99,7 +99,7 @@ public:
     void SwapData( SCH_ITEM* aItem ) override;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Function ReadImageFile
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index b509c04015..b51d14f193 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -187,7 +187,7 @@ void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
     COLOR4D color;
     EDA_RECT* clipbox = aPanel->GetClipBox();
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         color = aColor;
     else
         color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h
index 92e424c6fa..df073d9f8b 100644
--- a/eeschema/sch_bus_entry.h
+++ b/eeschema/sch_bus_entry.h
@@ -83,7 +83,7 @@ public:
     void SwapData( SCH_ITEM* aItem ) override;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     static bool Load( LINE_READER& aLine, wxString& aErrorMsg, SCH_ITEM **out );
 
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index 9c82fb70b1..1498ffe9a5 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -379,7 +379,7 @@ public:
      * Virtual function, from the base class SCH_ITEM::Draw
      */
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override
     {
         Draw( aPanel, aDC, aOffset, aDrawMode, aColor, true );
     }
@@ -392,7 +392,7 @@ public:
      * @param aOffset drawing Offset (usually wxPoint(0,0),
      *  but can be different when moving an object)
      * @param aDrawMode GR_OR, GR_XOR, ...
-     * @param aColor UNSPECIFIED_COLOR4D to use the normal body item color, or use this color if >= 0
+     * @param aColor COLOR4D::UNSPECIFIED to use the normal body item color, or use this color if >= 0
      * @param aDrawPinText = true to draw pin texts, false to draw only the pin shape
      *  usually false to draw a component when moving it, and true otherwise.
      */
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index 0a94046e8e..fc13b01d4f 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -141,7 +141,7 @@ public:
     int GetPenSize() const override;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     bool Save( FILE* aFile ) const override;
 
diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h
index 64484ea82b..7f5dc1f7b2 100644
--- a/eeschema/sch_item_struct.h
+++ b/eeschema/sch_item_struct.h
@@ -184,11 +184,11 @@ public:
      * @param aOffset drawing Offset (usually wxPoint(0,0),
      *  but can be different when moving an object)
      * @param aDrawMode GR_OR, GR_XOR, ...
-     * @param aColor UNSPECIFIED_COLOR4D to use the normal body item color,
+     * @param aColor COLOR4D::UNSPECIFIED to use the normal body item color,
      * or force this color if it is a valid color
      */
     virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&  aOffset,
-                       GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) = 0;
+                       GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) = 0;
 
     /**
      * Function Move
diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp
index 96c86760d3..3c2e1fdb58 100644
--- a/eeschema/sch_junction.cpp
+++ b/eeschema/sch_junction.cpp
@@ -115,7 +115,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
 {
     COLOR4D color;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         color = aColor;
     else
         color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h
index 28a1e23427..bd3133b6de 100644
--- a/eeschema/sch_junction.h
+++ b/eeschema/sch_junction.h
@@ -58,7 +58,7 @@ public:
     const EDA_RECT GetBoundingBox() const override;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     bool Save( FILE* aFile ) const override;
 
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 05eb3950cf..0d56ccb40b 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -217,7 +217,7 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
     COLOR4D color;
     int width = GetPenSize();
 
-    if( Color != UNSPECIFIED_COLOR4D )
+    if( Color != COLOR4D::UNSPECIFIED )
         color = Color;
     else
         color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index f1cb8c7f38..30435c6c10 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -85,7 +85,7 @@ public:
     double GetLength() const;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     bool Save( FILE* aFile ) const override;
 
diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp
index aaea0364eb..ff817df5f3 100644
--- a/eeschema/sch_marker.cpp
+++ b/eeschema/sch_marker.cpp
@@ -96,7 +96,7 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
                   GetLayerColor( LAYER_ERC_ERR ) : GetLayerColor( LAYER_ERC_WARN );
     }
 
-    if( aColor == UNSPECIFIED_COLOR4D )
+    if( aColor == COLOR4D::UNSPECIFIED )
         m_Color = color;
     else
         m_Color = aColor;
diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h
index a6e9199f6e..24c9fcccda 100644
--- a/eeschema/sch_marker.h
+++ b/eeschema/sch_marker.h
@@ -53,7 +53,7 @@ public:
     }
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDraw_mode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDraw_mode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     void Plot( PLOTTER* aPlotter ) override
     {
diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp
index a54c6d87cc..5a30375023 100644
--- a/eeschema/sch_no_connect.cpp
+++ b/eeschema/sch_no_connect.cpp
@@ -139,7 +139,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
 
     COLOR4D color;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         color = aColor;
     else
         color = GetLayerColor( LAYER_NOCONNECT );
diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h
index 6ef94e5a71..321eedbcae 100644
--- a/eeschema/sch_no_connect.h
+++ b/eeschema/sch_no_connect.h
@@ -56,7 +56,7 @@ public:
     void SwapData( SCH_ITEM* aItem ) override;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     bool Save( FILE* aFile ) const override;
 
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 7c55b8de15..8b58509ba9 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -592,7 +592,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
     int      lineWidth = GetPenSize();
     EDA_RECT* clipbox  = aPanel? aPanel->GetClipBox() : NULL;
 
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         color = aColor;
     else
         color = GetLayerColor( m_Layer );
@@ -611,7 +611,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
         name_orientation = TEXT_ANGLE_HORIZ;
 
     /* Draw text : SheetName */
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         txtcolor = aColor;
     else
         txtcolor = GetLayerColor( LAYER_SHEETNAME );
@@ -624,7 +624,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
                      false, false );
 
     /* Draw text : FileName */
-    if( aColor != UNSPECIFIED_COLOR4D )
+    if( aColor != COLOR4D::UNSPECIFIED )
         txtcolor = aColor;
     else
         txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
@@ -1138,7 +1138,7 @@ void SCH_SHEET::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
 
 void SCH_SHEET::Plot( PLOTTER* aPlotter )
 {
-    COLOR4D    txtcolor = UNSPECIFIED_COLOR4D;
+    COLOR4D    txtcolor = COLOR4D::UNSPECIFIED;
     wxSize      size;
     wxString    Text;
     int         name_orientation;
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 55037b6d20..71678ab1ea 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -113,7 +113,7 @@ public:
     bool IsMovableFromAnchorPoint() override { return true; }
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Function CreateGraphicShape (virtual)
@@ -429,7 +429,7 @@ public:
     int GetPenSize() const override;
 
     void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
-               GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     EDA_RECT const GetBoundingBox() const override;
 
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index 962cc16086..2846a5232b 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -350,7 +350,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
 
     linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
 
-    if( Color != UNSPECIFIED_COLOR4D )
+    if( Color != COLOR4D::UNSPECIFIED )
         color = Color;
     else
         color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -362,7 +362,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
     int savedWidth = GetThickness();
     SetThickness( linewidth );              // Set the minimum width
 
-    EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR4D );
+    EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, COLOR4D::UNSPECIFIED );
 
     SetThickness( savedWidth );
 
@@ -1275,7 +1275,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
     COLOR4D color;
     wxPoint     text_offset = aOffset + GetSchematicTextOffset();
 
-    if( Color != UNSPECIFIED_COLOR4D )
+    if( Color != COLOR4D::UNSPECIFIED )
         color = Color;
     else
         color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -1290,7 +1290,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
     SetThickness( linewidth );
 
     EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
-    EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR4D );
+    EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, COLOR4D::UNSPECIFIED );
 
     SetThickness( save_width );   // restore initial value
 
@@ -1645,7 +1645,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
 
     linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
 
-    if( Color != UNSPECIFIED_COLOR4D )
+    if( Color != COLOR4D::UNSPECIFIED )
         color = Color;
     else
         color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -1656,7 +1656,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
     SetThickness( linewidth );
 
     wxPoint text_offset = offset + GetSchematicTextOffset();
-    EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR4D );
+    EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, COLOR4D::UNSPECIFIED );
 
     SetThickness( save_width );         // restore initial value
 
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index 8aed3e5d65..529ccce377 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -132,7 +132,7 @@ public:
     virtual wxPoint GetSchematicTextOffset() const;
 
     virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
-                       GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
+                       GR_DRAWMODE draw_mode, COLOR4D Color = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Function CreateGraphicShape
@@ -228,7 +228,7 @@ public:
     ~SCH_LABEL() { }
 
     void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
-               GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE draw_mode, COLOR4D Color = COLOR4D::UNSPECIFIED ) override;
 
     wxString GetClass() const override
     {
@@ -274,7 +274,7 @@ public:
     ~SCH_GLOBALLABEL() { }
 
     void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
-               GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE draw_mode, COLOR4D Color = COLOR4D::UNSPECIFIED ) override;
 
     wxString GetClass() const override
     {
@@ -324,7 +324,7 @@ public:
     ~SCH_HIERLABEL() { }
 
     void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
-               GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
+               GR_DRAWMODE draw_mode, COLOR4D Color = COLOR4D::UNSPECIFIED ) override;
 
     wxString GetClass() const override
     {
diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp
index b43d233a31..5bf58c4b4b 100644
--- a/eeschema/schedit.cpp
+++ b/eeschema/schedit.cpp
@@ -708,7 +708,7 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
     if( aErase )
     {
         if( cmp )   // Use fast mode (do not draw pin texts)
-            cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR4D, false );
+            cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, COLOR4D::UNSPECIFIED, false );
         else
             item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
     }
@@ -723,7 +723,7 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
     item->SetWireImage();  // While moving, the item may choose to render differently
 
     if( cmp )   // Use fast mode (do not draw pin texts)
-        cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR4D, false );
+        cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, COLOR4D::UNSPECIFIED, false );
     else
         item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
 }
diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp
index 0e6d23d494..b778ad637e 100644
--- a/eeschema/symbdraw.cpp
+++ b/eeschema/symbdraw.cpp
@@ -240,7 +240,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
 
     if( m_drawItem->ContinueEdit( pos ) )
     {
-        m_drawItem->Draw( m_canvas, DC, pos, UNSPECIFIED_COLOR4D, g_XorMode, NULL, DefaultTransform );
+        m_drawItem->Draw( m_canvas, DC, pos, COLOR4D::UNSPECIFIED, g_XorMode, NULL, DefaultTransform );
         return;
     }
 
@@ -270,12 +270,12 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
         wxString    text = ((LIB_FIELD*)item)->GetFullText( unit );
 
         item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
-                    UNSPECIFIED_COLOR4D, g_XorMode, &text,
+                    COLOR4D::UNSPECIFIED, g_XorMode, &text,
                     DefaultTransform );
     }
     else
         item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
-                    UNSPECIFIED_COLOR4D, g_XorMode, NULL,
+                    COLOR4D::UNSPECIFIED, g_XorMode, NULL,
                     DefaultTransform );
 }
 
@@ -323,7 +323,7 @@ static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
         return;
 
     item->SetEraseLastDrawItem( aErase );
-    item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
+    item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
                 DefaultTransform );
 }
 
diff --git a/eeschema/widgets/widget_eeschema_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp
index e295ff3bfb..bd1dce6ba6 100644
--- a/eeschema/widgets/widget_eeschema_color_config.cpp
+++ b/eeschema/widgets/widget_eeschema_color_config.cpp
@@ -237,14 +237,14 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
     colourData.SetColour( currentColors[ colorButton->m_Layer ].ToColour() );
     wxColourDialog *dialog = new wxColourDialog( this, &colourData );
 
-    COLOR4D newColor = UNSPECIFIED_COLOR4D;
+    COLOR4D newColor = COLOR4D::UNSPECIFIED;
 
     if( dialog->ShowModal() == wxID_OK )
     {
         newColor = COLOR4D( dialog->GetColourData().GetColour() );
     }
 
-    if( newColor == UNSPECIFIED_COLOR4D || currentColors[ colorButton->m_Layer ] == newColor )
+    if( newColor == COLOR4D::UNSPECIFIED || currentColors[ colorButton->m_Layer ] == newColor )
         return;
 
     currentColors[ colorButton->m_Layer ] = newColor;
diff --git a/gerbview/class_gbr_display_options.h b/gerbview/class_gbr_display_options.h
index 3ff5179ce6..e4b17d44b5 100644
--- a/gerbview/class_gbr_display_options.h
+++ b/gerbview/class_gbr_display_options.h
@@ -64,7 +64,7 @@ public:
         m_DisplayNegativeObjects = false;
         m_ForceBlackAndWhite    = false;
         m_NegativeDrawColor     = COLOR4D( DARKGRAY );
-        m_BgDrawColor = COLOR4D_BLACK;
+        m_BgDrawColor = COLOR4D::BLACK;
     }
 };
 
diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp
index cc33e89306..f6c6ca9bb4 100644
--- a/gerbview/class_gerbview_layer_widget.cpp
+++ b/gerbview/class_gerbview_layer_widget.cpp
@@ -114,7 +114,7 @@ void GERBER_LAYER_WIDGET::ReFillRender()
 
     for( unsigned row=0;  row<DIM(renderRows);  ++row )
     {
-        if( renderRows[row].color != UNSPECIFIED_COLOR4D )       // does this row show a color?
+        if( renderRows[row].color != COLOR4D::UNSPECIFIED )       // does this row show a color?
         {
             renderRows[row].color = myframe->GetVisibleElementColor(
                                     (GERBER_VISIBLE_ID)renderRows[row].id );
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index 1e6795f2b0..7404f06178 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -609,7 +609,7 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
 
 COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const
 {
-    COLOR4D color = UNSPECIFIED_COLOR4D;
+    COLOR4D color = COLOR4D::UNSPECIFIED;
 
     switch( aItemIdVisible )
     {
diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h
index 2c35f8de0f..d6f5743c32 100644
--- a/include/class_drawpanel.h
+++ b/include/class_drawpanel.h
@@ -367,7 +367,7 @@ public:
      * @param aDC - the device context to draw the cursor
      * @param aColor - the color to draw the cursor
      */
-    void DrawCrossHair( wxDC* aDC, COLOR4D aColor = COLOR4D_WHITE );
+    void DrawCrossHair( wxDC* aDC, COLOR4D aColor = COLOR4D::WHITE );
 
     // Hide the cross hair.
     void CrossHairOff( wxDC* DC );
diff --git a/include/eda_text.h b/include/eda_text.h
index fafda2e633..a20aacc950 100644
--- a/include/eda_text.h
+++ b/include/eda_text.h
@@ -238,12 +238,12 @@ public:
      * @param aColor = text color
      * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
      * @param aDisplay_mode = FILLED or SKETCH
-     * @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR4D = do not draw anchor ).
+     * @param aAnchor_color = anchor color ( COLOR4D::UNSPECIFIED = do not draw anchor ).
      */
     void Draw( EDA_RECT* aClipBox, wxDC* aDC,
                const wxPoint& aOffset, COLOR4D aColor,
                GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = FILLED,
-               COLOR4D aAnchor_color = UNSPECIFIED_COLOR4D );
+               COLOR4D aAnchor_color = COLOR4D::UNSPECIFIED );
 
     /**
      * Convert the text shape to a list of segment
diff --git a/include/gal/color4d.h b/include/gal/color4d.h
index ba5ed34df1..4e0c0f4ae1 100644
--- a/include/gal/color4d.h
+++ b/include/gal/color4d.h
@@ -41,7 +41,7 @@ class COLOR4D
 public:
     // Constructor (creates the Color 0,0,0,0)
     COLOR4D() :
-        r( 0 ), g( 0 ), b( 0 ), a( 1 )
+        r( 0 ), g( 0 ), b( 0 ), a( 0 )
     {
     }
 
@@ -269,6 +269,13 @@ public:
     double g; ///< Green component
     double b; ///< Blue component
     double a; ///< Alpha component
+
+    /// For legacy support; used as a value to indicate color hasn't been set yet
+    static const COLOR4D UNSPECIFIED;
+
+    // Declare a few color shortcuts that are used for comparisons frequently
+    static const COLOR4D WHITE;
+    static const COLOR4D BLACK;
 };
 
 /// @brief Equality operator, are two colors equal
@@ -279,12 +286,4 @@ const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
 
 } // namespace KIGFX
 
-/// For legacy support; used as a value to indicate color hasn't been set yet
-#define UNSPECIFIED_COLOR4D ( KIGFX::COLOR4D( 0, 0, 0, 0 ) )
-
-/// Declare a few color shortcuts that are used for comparisons frequently
-#define COLOR4D_WHITE ( KIGFX::COLOR4D( 1, 1, 1, 1 ) )
-#define COLOR4D_BLACK ( KIGFX::COLOR4D( 0, 0, 0, 1 ) )
-
-
 #endif /* COLOR4D_H_ */
diff --git a/include/msgpanel.h b/include/msgpanel.h
index f4dbe13d65..04a0dd2637 100644
--- a/include/msgpanel.h
+++ b/include/msgpanel.h
@@ -82,7 +82,7 @@ public:
         m_X = 0;
         m_UpperY = 0;
         m_LowerY = 0;
-        m_Color = UNSPECIFIED_COLOR4D;
+        m_Color = COLOR4D::UNSPECIFIED;
     }
 
     void SetUpperText( const wxString& aUpperText ) { m_UpperText = aUpperText; }
diff --git a/include/plot_common.h b/include/plot_common.h
index c75fda7560..4fc54a5378 100644
--- a/include/plot_common.h
+++ b/include/plot_common.h
@@ -1209,7 +1209,7 @@ public:
     DXF_PLOTTER() : textAsLines( false )
     {
         textAsLines = true;
-        m_currentColor = COLOR4D_BLACK;
+        m_currentColor = COLOR4D::BLACK;
     }
 
     virtual PlotFormat GetPlotterType() const override
diff --git a/include/worksheet_shape_builder.h b/include/worksheet_shape_builder.h
index b88a5bd1a6..c9bcd904b4 100644
--- a/include/worksheet_shape_builder.h
+++ b/include/worksheet_shape_builder.h
@@ -91,13 +91,13 @@ public:
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC)
     {
         wxPoint offset( 0, 0 );
-        DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, UNSPECIFIED_COLOR4D );
+        DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, COLOR4D::UNSPECIFIED );
     }
 
     /// More advanced version of DrawWsItem. This is what must be
     /// defined in the derived type.
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
-            GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) = 0;
+            GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) = 0;
 
     /**
      * Abstract function: should exist for derived items
@@ -159,7 +159,7 @@ public:
     /** The function to draw a WS_DRAW_ITEM_LINE
      */
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
-            GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+            GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Virtual function
@@ -216,7 +216,7 @@ public:
     /** The function to draw a WS_DRAW_ITEM_POLYGON
      */
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
-            GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+            GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Virtual function
@@ -251,7 +251,7 @@ public:
     /** The function to draw a WS_DRAW_ITEM_RECT
      */
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
-            GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+            GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Virtual function
@@ -292,7 +292,7 @@ public:
     /** The function to draw a WS_DRAW_ITEM_TEXT
      */
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
-            GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+            GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     // Accessors:
     int GetPenWidth() { return GetThickness(); }
@@ -327,13 +327,13 @@ class WS_DRAW_ITEM_BITMAP : public WS_DRAW_ITEM_BASE
 
 public:
     WS_DRAW_ITEM_BITMAP( WORKSHEET_DATAITEM* aParent, wxPoint aPos )
-        :WS_DRAW_ITEM_BASE( aParent, wsg_bitmap, UNSPECIFIED_COLOR4D )
+        :WS_DRAW_ITEM_BASE( aParent, wsg_bitmap, COLOR4D::UNSPECIFIED )
     {
         m_pos = aPos;
     }
 
     WS_DRAW_ITEM_BITMAP()
-        :WS_DRAW_ITEM_BASE( NULL, wsg_bitmap, UNSPECIFIED_COLOR4D )
+        :WS_DRAW_ITEM_BASE( NULL, wsg_bitmap, COLOR4D::UNSPECIFIED )
     {
     }
 
@@ -342,7 +342,7 @@ public:
     /** The function to draw a WS_DRAW_ITEM_BITMAP
      */
     virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
-            GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
+            GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
 
     /**
      * Virtual function
diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp
index 165e6d70a3..2de743e6f2 100644
--- a/pcbnew/autorouter/auto_place_footprints.cpp
+++ b/pcbnew/autorouter/auto_place_footprints.cpp
@@ -425,7 +425,7 @@ void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC )
         for( jj = 0; jj < RoutingMatrix.m_Ncols; jj++ )
         {
             ox      = RoutingMatrix.m_BrdBox.GetX() + (jj * RoutingMatrix.m_GridRouting);
-            color   = COLOR4D_BLACK;
+            color   = COLOR4D::BLACK;
 
             top_state       = RoutingMatrix.GetCell( ii, jj, TOP );
             bottom_state    = RoutingMatrix.GetCell( ii, jj, BOTTOM );
@@ -435,7 +435,7 @@ void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC )
 
             // obstacles
             if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
-                color = COLOR4D_WHITE;
+                color = COLOR4D::WHITE;
             else if( top_state & ( HOLE | CELL_is_MODULE ) )
                 color = COLOR4D( LIGHTRED );
             else if( bottom_state & (HOLE | CELL_is_MODULE) )
diff --git a/pcbnew/autorouter/autorout.cpp b/pcbnew/autorouter/autorout.cpp
index 5044172ba8..c7f77f8a62 100644
--- a/pcbnew/autorouter/autorout.cpp
+++ b/pcbnew/autorouter/autorout.cpp
@@ -236,7 +236,7 @@ void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
     {
         for( int row = 0; row < RoutingMatrix.m_Nrows; row++ )
         {
-            color  = COLOR4D_BLACK;
+            color  = COLOR4D::BLACK;
             dcell0 = RoutingMatrix.GetCell( row, col, BOTTOM );
 
             if( dcell0 & HOLE )
@@ -253,7 +253,7 @@ void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
 
             dcell0 |= dcell1;
 #endif
-            if( ( color == COLOR4D_BLACK ) && ( dcell0 & VIA_IMPOSSIBLE ) )
+            if( ( color == COLOR4D::BLACK ) && ( dcell0 & VIA_IMPOSSIBLE ) )
                 color = COLOR4D( BLUE );
 
             if( dcell0 & CELL_is_EDGE )
diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp
index 92ee3e846e..1e38be4e55 100644
--- a/pcbnew/board_items_to_polygon_shape_transform.cpp
+++ b/pcbnew/board_items_to_polygon_shape_transform.cpp
@@ -445,7 +445,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
     s_cornerBuffer = &aCornerBuffer;
     s_textWidth  = GetThickness() + ( 2 * aClearanceValue );
     s_textCircle2SegmentCount = aCircleToSegmentsCount;
-    COLOR4D color = COLOR4D_BLACK;  // not actually used, but needed by DrawGraphicText
+    COLOR4D color = COLOR4D::BLACK;  // not actually used, but needed by DrawGraphicText
 
     if( IsMultilineAllowed() )
     {
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index a6c82abe39..4d672ab59b 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -779,7 +779,7 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
 
 COLOR4D BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
 {
-    COLOR4D color = UNSPECIFIED_COLOR4D;
+    COLOR4D color = COLOR4D::UNSPECIFIED;
 
     switch( aPCB_VISIBLE )
     {
diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp
index 0a498875e8..86fba2b346 100644
--- a/pcbnew/class_pad_draw_functions.cpp
+++ b/pcbnew/class_pad_draw_functions.cpp
@@ -130,7 +130,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
     else
         drawInfo.m_ShowPadFilled = true;
 
-    COLOR4D color = COLOR4D_BLACK;
+    COLOR4D color = COLOR4D::BLACK;
 
     if( m_layerMask[F_Cu] )
     {
diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp
index 0fe14ed96d..b9ada8660c 100644
--- a/pcbnew/class_pcb_layer_widget.cpp
+++ b/pcbnew/class_pcb_layer_widget.cpp
@@ -67,17 +67,17 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
     RR( _( "Pads Front" ),      PAD_FR_VISIBLE,         WHITE,      _( "Show footprint pads on board's front" ) ),
     RR( _( "Pads Back" ),       PAD_BK_VISIBLE,         WHITE,      _( "Show footprint pads on board's back" ) ),
 
-    RR( _( "Text Front" ),      MOD_TEXT_FR_VISIBLE,    UNSPECIFIED_COLOR4D,  _( "Show footprint text on board's front" ) ),
-    RR( _( "Text Back" ),       MOD_TEXT_BK_VISIBLE,    UNSPECIFIED_COLOR4D,  _( "Show footprint text on board's back" ) ),
+    RR( _( "Text Front" ),      MOD_TEXT_FR_VISIBLE,    COLOR4D::UNSPECIFIED,  _( "Show footprint text on board's front" ) ),
+    RR( _( "Text Back" ),       MOD_TEXT_BK_VISIBLE,    COLOR4D::UNSPECIFIED,  _( "Show footprint text on board's back" ) ),
     RR( _( "Hidden Text" ),     MOD_TEXT_INVISIBLE,     WHITE,      _( "Show footprint text marked as invisible" ) ),
 
     RR( _( "Anchors" ),         ANCHOR_VISIBLE,         WHITE,      _( "Show footprint and text origins as a cross" ) ),
     RR( _( "Grid" ),            GRID_VISIBLE,           WHITE,      _( "Show the (x,y) grid dots" ) ),
-    RR( _( "No-Connects" ),     NO_CONNECTS_VISIBLE,    UNSPECIFIED_COLOR4D,  _( "Show a marker on pads which have no net connected" ) ),
-    RR( _( "Footprints Front" ),   MOD_FR_VISIBLE,         UNSPECIFIED_COLOR4D,  _( "Show footprints that are on board's front") ),
-    RR( _( "Footprints Back" ),    MOD_BK_VISIBLE,         UNSPECIFIED_COLOR4D,  _( "Show footprints that are on board's back") ),
-    RR( _( "Values" ),          MOD_VALUES_VISIBLE,     UNSPECIFIED_COLOR4D,  _( "Show footprint's values") ),
-    RR( _( "References" ),      MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR4D,  _( "Show footprint's references") ),
+    RR( _( "No-Connects" ),     NO_CONNECTS_VISIBLE,    COLOR4D::UNSPECIFIED,  _( "Show a marker on pads which have no net connected" ) ),
+    RR( _( "Footprints Front" ),   MOD_FR_VISIBLE,         COLOR4D::UNSPECIFIED,  _( "Show footprints that are on board's front") ),
+    RR( _( "Footprints Back" ),    MOD_BK_VISIBLE,         COLOR4D::UNSPECIFIED,  _( "Show footprints that are on board's back") ),
+    RR( _( "Values" ),          MOD_VALUES_VISIBLE,     COLOR4D::UNSPECIFIED,  _( "Show footprint's values") ),
+    RR( _( "References" ),      MOD_REFERENCES_VISIBLE, COLOR4D::UNSPECIFIED,  _( "Show footprint's references") ),
 };
 
 static int s_allowed_in_FpEditor[] =
@@ -299,7 +299,7 @@ void PCB_LAYER_WIDGET::ReFillRender()
         renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
         renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
 
-        if( renderRow.color != UNSPECIFIED_COLOR4D )       // does this row show a color?
+        if( renderRow.color != COLOR4D::UNSPECIFIED )       // does this row show a color?
         {
             // this window frame must have an established BOARD, i.e. after SetBoard()
             renderRow.color = board->GetVisibleElementColor( renderRow.id );
diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp
index 6c2217a4b4..e7f7fecc86 100644
--- a/pcbnew/class_pcb_text.cpp
+++ b/pcbnew/class_pcb_text.cpp
@@ -93,7 +93,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
             color = COLOR4D( DARKDARKGRAY );
     }
 
-    COLOR4D anchor_color = UNSPECIFIED_COLOR4D;
+    COLOR4D anchor_color = COLOR4D::UNSPECIFIED;
 
     if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
         anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE );
diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp
index 68ec60cee5..af39ad8433 100644
--- a/pcbnew/dialogs/dialog_SVG_print.cpp
+++ b/pcbnew/dialogs/dialog_SVG_print.cpp
@@ -336,7 +336,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName, bool aOnlyO
     plot_opts.SetMirror( m_printMirror );
     plot_opts.SetFormat( PLOT_FORMAT_SVG );
 
-    COLOR4D color = UNSPECIFIED_COLOR4D;      // Used layer color to plot ref and value
+    COLOR4D color = COLOR4D::UNSPECIFIED;      // Used layer color to plot ref and value
 
     plot_opts.SetReferenceColor( color );
     plot_opts.SetValueColor( color );
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index 919df4f5da..51a9e5a3ea 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -167,7 +167,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
     wxPaintDC    dc( m_panelShowPad );
     PAD_DRAWINFO drawInfo;
 
-    COLOR4D color = COLOR4D_BLACK;
+    COLOR4D color = COLOR4D::BLACK;
 
     if( m_dummyPad->GetLayerSet()[F_Cu] )
     {
diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp
index 8b502dee58..e1ba044d26 100644
--- a/pcbnew/exporters/export_vrml.cpp
+++ b/pcbnew/exporters/export_vrml.cpp
@@ -734,7 +734,7 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
     if( text->IsMirrored() )
         size.x = -size.x;
 
-    COLOR4D color = COLOR4D_BLACK;  // not actually used, but needed by DrawGraphicText
+    COLOR4D color = COLOR4D::BLACK;  // not actually used, but needed by DrawGraphicText
 
     if( text->IsMultilineAllowed() )
     {
diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp
index 36e7ad3450..ffc9459a79 100644
--- a/pcbnew/exporters/gen_drill_report_files.cpp
+++ b/pcbnew/exporters/gen_drill_report_files.cpp
@@ -219,7 +219,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
 
     // Plot title  "Info"
     wxString Text = wxT( "Drill Map:" );
-    plotter->Text( wxPoint( plotX, plotY ), UNSPECIFIED_COLOR4D, Text, 0,
+    plotter->Text( wxPoint( plotX, plotY ), COLOR4D::UNSPECIFIED, Text, 0,
                    wxSize( KiROUND( charSize * charScale ),
                            KiROUND( charSize * charScale ) ),
                    GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
@@ -266,7 +266,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
         if( tool.m_Hole_NotPlated )
             msg += wxT( " (not plated)" );
 
-        plotter->Text( wxPoint( plotX, y ), UNSPECIFIED_COLOR4D, msg, 0,
+        plotter->Text( wxPoint( plotX, y ), COLOR4D::UNSPECIFIED, msg, 0,
                        wxSize( KiROUND( charSize * charScale ),
                                KiROUND( charSize * charScale ) ),
                        GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp
index 181cce12ba..5eb11b047d 100644
--- a/pcbnew/layer_widget.cpp
+++ b/pcbnew/layer_widget.cpp
@@ -283,7 +283,7 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& aEvent )
 
     COLOR4D oldColor;
     wxASSERT( oldColor.SetFromWxString( colorTxt ) );
-    COLOR4D newColor = UNSPECIFIED_COLOR4D;
+    COLOR4D newColor = COLOR4D::UNSPECIFIED;
 
     if( AreArbitraryColorsAllowed() )
     {
@@ -301,7 +301,7 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& aEvent )
         newColor = DisplayColorFrame( this, oldColor );
     }
 
-    if( newColor != UNSPECIFIED_COLOR4D )
+    if( newColor != COLOR4D::UNSPECIFIED )
     {
         eventSource->SetName( makeColorTxt( newColor ) );
 
@@ -339,7 +339,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
 
     COLOR4D oldColor;
     wxASSERT( oldColor.SetFromWxString( colorTxt ) );
-    COLOR4D newColor = UNSPECIFIED_COLOR4D;
+    COLOR4D newColor = COLOR4D::UNSPECIFIED;
 
     if( AreArbitraryColorsAllowed() )
     {
@@ -357,7 +357,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
         newColor = DisplayColorFrame( this, oldColor );
     }
 
-    if( newColor != UNSPECIFIED_COLOR4D )
+    if( newColor != COLOR4D::UNSPECIFIED )
     {
         eventSource->SetName( makeColorTxt( newColor ) );
 
@@ -495,7 +495,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
 
     // column 0
     col = 0;
-    if( aSpec.color != UNSPECIFIED_COLOR4D )
+    if( aSpec.color != COLOR4D::UNSPECIFIED )
     {
         wxBitmapButton* bmb = makeColorButton( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) );
         bmb->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownRenderColor ), NULL, this );
@@ -827,7 +827,7 @@ COLOR4D LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const
         return ColorFromInt( strtoul( TO_UTF8(colorTxt), NULL, 0 ) );
     }
 
-    return UNSPECIFIED_COLOR4D;   // it's caller fault, gave me a bad layer
+    return COLOR4D::UNSPECIFIED;   // it's caller fault, gave me a bad layer
 }
 
 
@@ -951,7 +951,7 @@ public:
 
         // add some render rows
         static const LAYER_WIDGET::ROW renderRows[] = {
-            LAYER_WIDGET::ROW( wxT("With Very Large Ears"), 0, UNSPECIFIED_COLOR4D, wxT("Spock here") ),
+            LAYER_WIDGET::ROW( wxT("With Very Large Ears"), 0, COLOR4D::UNSPECIFIED, wxT("Spock here") ),
             LAYER_WIDGET::ROW( wxT("With Legs"), 1, YELLOW ),
             LAYER_WIDGET::ROW( wxT("With Oval Eyes"), 1, BROWN, wxT("My eyes are upon you") ),
         };
diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h
index de4a33c95f..23624e340a 100644
--- a/pcbnew/layer_widget.h
+++ b/pcbnew/layer_widget.h
@@ -85,11 +85,11 @@ public:
     {
         wxString    rowName;    ///< the prompt or layername
         int         id;         ///< either a layer or "visible element" id
-        COLOR4D     color;      ///< UNSPECIFIED_COLOR4D if none.
+        COLOR4D     color;      ///< COLOR4D::UNSPECIFIED if none.
         bool        state;      ///< initial wxCheckBox state
         wxString    tooltip;    ///< if not empty, use this tooltip on row
 
-        ROW( const wxString& aRowName, int aId, COLOR4D aColor = UNSPECIFIED_COLOR4D,
+        ROW( const wxString& aRowName, int aId, COLOR4D aColor = COLOR4D::UNSPECIFIED,
             const wxString& aTooltip = wxEmptyString, bool aState = true )
         {
             rowName = aRowName;
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index 87113789ef..be39fc2d54 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -98,13 +98,13 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
                 if( !( masklayer & layersmask_plotpads ).any() )
                     continue;
 
-                COLOR4D color = COLOR4D_BLACK;
+                COLOR4D color = COLOR4D::BLACK;
 
                 if( layersmask_plotpads[B_SilkS] )
                    color = aBoard->GetLayerColor( B_SilkS );
 
                 if( layersmask_plotpads[F_SilkS] )
-                    color = ( color == COLOR4D_BLACK) ? aBoard->GetLayerColor( F_SilkS ) : color;
+                    color = ( color == COLOR4D::BLACK) ? aBoard->GetLayerColor( F_SilkS ) : color;
 
                 itemplotter.PlotPad( pad, color, SKETCH );
             }
@@ -408,7 +408,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
             if( padPlotsSize.x <= 0 || padPlotsSize.y <= 0 )
                 continue;
 
-            COLOR4D color = COLOR4D_BLACK;
+            COLOR4D color = COLOR4D::BLACK;
 
             if( pad->GetLayerSet()[B_Cu] )
                color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE );
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index 91c4bd0958..704f0c32bf 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -57,7 +57,7 @@
 COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
 {
     COLOR4D color = m_board->GetLayerColor( ToLAYER_ID( aLayer ) );
-    if( color == COLOR4D_WHITE )
+    if( color == COLOR4D::WHITE )
         color = COLOR4D( LIGHTGRAY );
     return color;
 }
@@ -223,7 +223,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
     // Plot text fields, if allowed
     if( trace_ref )
     {
-        if( GetReferenceColor() == UNSPECIFIED_COLOR4D )
+        if( GetReferenceColor() == COLOR4D::UNSPECIFIED )
             PlotTextModule( &aModule->Reference(), getColor( textLayer ) );
         else
             PlotTextModule( &aModule->Reference(), GetReferenceColor() );
@@ -231,7 +231,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
 
     if( trace_val )
     {
-        if( GetValueColor() == UNSPECIFIED_COLOR4D )
+        if( GetValueColor() == COLOR4D::UNSPECIFIED )
             PlotTextModule( &aModule->Value(), getColor( textLayer ) );
         else
             PlotTextModule( &aModule->Value(), GetValueColor() );
@@ -299,7 +299,7 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, COLOR4D aColor )
     double  orient;
     int     thickness;
 
-    if( aColor == COLOR4D_WHITE )
+    if( aColor == COLOR4D::WHITE )
         aColor = COLOR4D( LIGHTGRAY );
 
     m_plotter->SetColor( aColor );
@@ -591,14 +591,14 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
         for( unsigned ii = 0; ii <  strings_list.Count(); ii++ )
         {
             wxString& txt =  strings_list.Item( ii );
-            m_plotter->Text( positions[ii], UNSPECIFIED_COLOR4D, txt, orient, size,
+            m_plotter->Text( positions[ii], COLOR4D::UNSPECIFIED, txt, orient, size,
                              pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
                              thickness, pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
         }
     }
     else
     {
-        m_plotter->Text( pos, UNSPECIFIED_COLOR4D, shownText, orient, size,
+        m_plotter->Text( pos, COLOR4D::UNSPECIFIED, shownText, orient, size,
                          pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
                          thickness, pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
     }
diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp
index 00aef8b8f8..016688c876 100644
--- a/pcbnew/print_board_functions.cpp
+++ b/pcbnew/print_board_functions.cpp
@@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
     if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
     {
         TRACK*      track = Pcb->m_Track;
-        COLOR4D     color = COLOR4D_WHITE;
+        COLOR4D     color = COLOR4D::WHITE;
 
         bool blackpenstate = GetGRForceBlackPenState();