← Back to team overview

kicad-developers team mailing list archive

Enhanced palette for kicad

 

After years of intensive usage I decided that the kicad palette (pcbnew
to be exact) was too limited. I 'simply' added another level of
brightness for every color while maintaining the dynamic range. Also had
to make sure everything was contrasted and stuff when shown ORed (the
comments actually cautioned about that!)

Anyway, with this you can see how tracks go on pad *and* having a good
track highlighting without using sketch mode. The one issue is that
color numbers are not backward compatible, i.e. you have to reassign
them...

The light yellow (an anomaly) remains because: it may be useful for
*something* (i.e. backward compatibility), I had to fill the hole in the
grid and anyway is somewhat cute...

Attached: 
- The patch (quite obvious)
- A screenshot of the new palette
- A screenshot of pcbnew in actual use

I actually usually work with silk screen and courtyard disabled, but
it's pretty usable even with this level of junk. Subdued colours are
useful to avoid retinal burn after 8 hours of trackage XD. Of course
nothing could help if you wanted to track 4 copper layers or more
simultaneously... 

PS: I use ECO1 for the courtyard. However in these days I committed
some of (a lot of) changes enabling to add lots of layers in the near
future (I was waiting for the new file format for this). I hope to have
soon assembly and courtyards as separate and properly flippable layers.

-- 
Lorenzo Marcantonio
Logos Srl

Attachment: palette.png
Description: PNG image

Attachment: pcbnew.png
Description: PNG image

=== modified file 'common/common.cpp'
--- common/common.cpp	2013-03-30 09:28:59 +0000
+++ common/common.cpp	2013-04-01 16:57:24 +0000
@@ -72,34 +72,50 @@
  * Please: if you change a value, remember these values are carefully chosen
  * to have good results in Pcbnew, that uses the ORed value of basic colors
  * when displaying superimposed objects
- * This list must have exactly NBCOLOR items
- */
-StructColors ColorRefs[NBCOLOR] =
+ * This list must have exactly NBCOLORS items
+ */
+/*
+ * The new 'rationalized' value sequence for colours:
+ *  72 01001000 <<
+ * 104 01101000
+ * 132 10000100 <<
+ * 164 10100100
+ * 194 11000010 <<
+ * 226 11100010
+ * 255 11111111 <<
+ */
+StructColors ColorRefs[NBCOLORS] =
 {
-    { 0,    0,   0,   BLACK,        wxT( "BLACK" ),        DARKDARKGRAY          },
-    { 192,  0,   0,   BLUE,         wxT( "BLUE" ),         LIGHTBLUE             },
-    { 0,    160, 0,   GREEN,        wxT( "GREEN" ),        LIGHTGREEN            },
-    { 160,  160, 0,   CYAN,         wxT( "CYAN" ),         LIGHTCYAN             },
-    { 0,    0,   160, RED,          wxT( "RED" ),          LIGHTRED              },
-    { 160,  0,   160, MAGENTA,      wxT( "MAGENTA" ),      LIGHTMAGENTA          },
-    { 0,    128, 128, BROWN,        wxT( "BROWN" ),        YELLOW                },
-    { 192,  192, 192, LIGHTGRAY,    wxT( "GRAY" ),         WHITE                 },
-    { 128,  128, 128, DARKGRAY,     wxT( "DARKGRAY" ),     LIGHTGRAY             },
-    { 255,  0,   0,   LIGHTBLUE,    wxT( "LIGHTBLUE" ),    LIGHTBLUE             },
-    { 0,    255, 0,   LIGHTGREEN,   wxT( "LIGHTGREEN" ),   LIGHTGREEN            },
-    { 255,  255, 0,   LIGHTCYAN,    wxT( "LIGHTCYAN" ),    LIGHTCYAN             },
-    { 0,    0,   255, LIGHTRED,     wxT( "LIGHTRED" ),     LIGHTRED              },
-    { 255,  0,   255, LIGHTMAGENTA, wxT( "LIGHTMAGENTA" ), LIGHTMAGENTA          },
-    { 0,    255, 255, YELLOW,       wxT( "YELLOW" ),       YELLOW                },
-    { 255,  255, 255, WHITE,        wxT( "WHITE" ),        WHITE                 },
-    {  64,  64,  64,  DARKDARKGRAY, wxT( "DARKDARKGRAY" ), DARKGRAY              },
-    {  64,  0,   0,   DARKBLUE,     wxT( "DARKBLUE" ),     BLUE                  },
-    {    0, 64,  0,   DARKGREEN,    wxT( "DARKGREEN" ),    GREEN                 },
-    {  64,  64,  0,   DARKCYAN,     wxT( "DARKCYAN" ),     CYAN                  },
-    {    0, 0,   80,  DARKRED,      wxT( "DARKRED" ),      RED                   },
-    {  64,  0,   64,  DARKMAGENTA,  wxT( "DARKMAGENTA" ),  MAGENTA               },
-    {    0, 64,  64,  DARKBROWN,    wxT( "DARKBROWN" ),    BROWN                 },
-    {  128, 255, 255, LIGHTYELLOW,  wxT( "LIGHTYELLOW" ),  LIGHTYELLOW           }
+    { 0,    0,   0,   BLACK,         wxT( "Black" ),     DARKDARKGRAY      },
+    { 72,   72,  72,  DARKDARKGRAY,  wxT( "Gray 1" ),    DARKGRAY          },
+    { 132,  132, 132, DARKGRAY,      wxT( "Gray 2" ),    LIGHTGRAY         },
+    { 194,  194, 194, LIGHTGRAY,     wxT( "Gray 3" ),    WHITE             },
+    { 255,  255, 255, WHITE,         wxT( "White" ),     WHITE             },
+    { 194,  255, 255, LIGHTYELLOW,   wxT( "L.Yellow" ),  WHITE             },
+    { 72,   0,   0,   DARKBLUE,      wxT( "Blue 1" ),    BLUE              },
+    { 0,    72,  0,   DARKGREEN,     wxT( "Green 1" ),   GREEN             },
+    { 72,   72,  0,   DARKCYAN,      wxT( "Cyan 1" ),    CYAN              },
+    { 0,    0,   72,  DARKRED,       wxT( "Red 1" ),     RED               },
+    { 72,   0,   72,  DARKMAGENTA,   wxT( "Magenta 1" ), MAGENTA           },
+    { 0,    72,  72,  DARKBROWN,     wxT( "Brown 1" ),   BROWN             },
+    { 132,  0,   0,   BLUE,          wxT( "Blue 2" ),    LIGHTBLUE         },
+    { 0,    132, 0,   GREEN,         wxT( "Green 2" ),   LIGHTGREEN        },
+    { 132,  132, 0,   CYAN,          wxT( "Cyan 2" ),    LIGHTCYAN         },
+    { 0,    0,   132, RED,           wxT( "Red 2" ),     LIGHTRED          },
+    { 132,  0,   132, MAGENTA,       wxT( "Magenta 2" ), LIGHTMAGENTA      },
+    { 0,    132, 132, BROWN,         wxT( "Brown 2" ),   YELLOW            },
+    { 194,  0,   0,   LIGHTBLUE,     wxT( "Blue 3" ),    PUREBLUE,         },
+    { 0,    194, 0,   LIGHTGREEN,    wxT( "Green 3" ),   PUREGREEN         },
+    { 194,  194, 0,   LIGHTCYAN,     wxT( "Cyan 3" ),    PURECYAN          },
+    { 0,    0,   194, LIGHTRED,      wxT( "Red 3" ),     PURERED           },
+    { 194,  0,   194, LIGHTMAGENTA,  wxT( "Magenta 3" ), PUREMAGENTA       },
+    { 0,    194, 194, YELLOW,        wxT( "Yellow 3" ),  PUREYELLOW        },
+    { 255,  0,   0,   PUREBLUE,      wxT( "Blue 4" ),    WHITE             },
+    { 0,    255, 0,   PUREGREEN,     wxT( "Green 4" ),   WHITE             },
+    { 255,  255, 0,   PURECYAN,      wxT( "Cyan 4" ),    WHITE             },
+    { 0,    0,   255, PURERED,       wxT( "Red 4" ),     WHITE             },
+    { 255,  0,   255, PUREMAGENTA,   wxT( "Magenta 4" ), WHITE             },
+    { 0,    255, 255, PUREYELLOW,    wxT( "Yellow 4" ),  WHITE             },
 };
 
 

=== modified file 'common/common_plotDXF_functions.cpp'
--- common/common_plotDXF_functions.cpp	2013-03-07 14:15:35 +0000
+++ common/common_plotDXF_functions.cpp	2013-04-01 16:56:37 +0000
@@ -151,7 +151,7 @@
              "  2\n"
              "LAYER\n"
              "  70\n"
-             "%d\n", NBCOLOR );
+             "%d\n", NBCOLORS );
 
     /* The layer/colors palette. The acad/DXF palette is divided in 3 zones:
 
@@ -159,7 +159,7 @@
        - An HSV zone (10-250, 5 values x 2 saturations x 10 hues
        - Greys (251 - 255)
 
-       The is *no* black... the white does it on paper, usually, and
+       There is *no* black... the white does it on paper, usually, and
        anyway it depends on the plotter configuration, since DXF colors
        are meant to be logical only (they represent *both* line color and
        width); later version with plot styles only complicate the matter!
@@ -170,7 +170,7 @@
     static const struct {
         const char *name;
         int color;
-    } dxf_layer[NBCOLOR] = {
+    } dxf_layer[NBCOLORS] = {
         { "BLACK",              250 },
         { "BLUE",               5 },
         { "GREEN",              3 },
@@ -195,9 +195,15 @@
         { "DARKMAGENTA",        228 },
         { "DARKBROWN",          58 },
         { "LIGHTYELLOW",        51 },
+        { "PUREBLUE",           5 },
+        { "PUREGREEN",          3 },
+        { "PURECYAN",           4 },
+        { "PURERED",            1 },
+        { "PUREMAGENTA",        6 },
+        { "PUREYELLOW",         2 }
     };
 
-    for( int i = 0; i < NBCOLOR; i++ )
+    for( int i = 0; i < NBCOLORS; i++ )
     {
         wxString cname = ColorRefs[i].m_Name;
         fprintf( outputFile,

=== modified file 'common/selcolor.cpp'
--- common/selcolor.cpp	2012-09-22 11:19:37 +0000
+++ common/selcolor.cpp	2013-04-01 16:56:37 +0000
@@ -54,7 +54,7 @@
                                                             framepos, OldColor );
     color = static_cast<EDA_COLOR_T>( frame->ShowModal() );
     frame->Destroy();
-    if( color > NBCOLOR )
+    if( color > NBCOLORS )
         color = UNSPECIFIED_COLOR;
     return color;
 }
@@ -137,17 +137,17 @@
     MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
     OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
 
-    for( ii = 0; ColorRefs[ii].m_Name != NULL && ii < NBCOLOR; ii++ )
+    for( ii = 0; ColorRefs[ii].m_Name != NULL && ii < NBCOLORS; ii++ )
     {
-        // Provide a separate column for every eight buttons (and their
+        // Provide a separate column for every six buttons (and their
         // associated text strings), so provide a FlexGrid Sizer with
         // eight rows and two columns.
-        if( ii % 8 == 0 )
+        if( ii % 6 == 0 )
         {
-            FlexColumnBoxSizer = new wxFlexGridSizer( 8, 2, 0, 0 );
+            FlexColumnBoxSizer = new wxFlexGridSizer( 6, 2, 0, 0 );
 
             // Specify that all of the rows can be expanded.
-            for( int ii = 0; ii < 8; ii++ )
+            for( int ii = 0; ii < 6; ii++ )
             {
                 FlexColumnBoxSizer->AddGrowableRow( ii );
             }

=== modified file 'include/colors.h'
--- include/colors.h	2012-09-02 16:38:52 +0000
+++ include/colors.h	2013-04-01 16:56:37 +0000
@@ -14,39 +14,44 @@
 {
     UNSPECIFIED_COLOR = -1,
     BLACK = 0,
+    DARKDARKGRAY,
+    DARKGRAY,
+    LIGHTGRAY,
+    WHITE,
+    LIGHTYELLOW,
+    DARKBLUE,
+    DARKGREEN,
+    DARKCYAN,
+    DARKRED,
+    DARKMAGENTA,
+    DARKBROWN,
     BLUE,
     GREEN,
     CYAN,
     RED,
     MAGENTA,
     BROWN,
-    LIGHTGRAY,
-    DARKGRAY,
     LIGHTBLUE,
     LIGHTGREEN,
     LIGHTCYAN,
     LIGHTRED,
     LIGHTMAGENTA,
     YELLOW,
-    WHITE,
-    DARKDARKGRAY,
-    DARKBLUE,
-    DARKGREEN,
-    DARKCYAN,
-    DARKRED,
-    DARKMAGENTA,
-    DARKBROWN,
-    LIGHTYELLOW,
-    LASTCOLOR,
+    PUREBLUE,   
+    PUREGREEN,  
+    PURECYAN,   
+    PURERED,    
+    PUREMAGENTA,
+    PUREYELLOW, 
+    NBCOLORS,                    ///< Number of colors
     HIGHLIGHT_FLAG =  ( 1<<19 ),
-    NBCOLOR        =    24,      ///< Number of colors
     MASKCOLOR      =    31       ///< mask for color index into ColorRefs[]
 };
 
 /// Checked cast. Use only when necessary (ex. I/O)
 inline EDA_COLOR_T ColorFromInt( int aColor )
 {
-    wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor < LASTCOLOR );
+    wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor < NBCOLORS );
     return static_cast<EDA_COLOR_T>( aColor );
 }
 
@@ -106,7 +111,7 @@
 };
 
 // list of existing Colors:
-extern StructColors ColorRefs[NBCOLOR];
+extern StructColors ColorRefs[NBCOLORS];
 
 /**
  * Function MakeColour


Follow ups