Index: /trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java	(revision 1444)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java	(revision 1445)
@@ -12,4 +12,5 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -27,4 +28,5 @@
 import javax.swing.JTable;
 import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
 import javax.swing.table.DefaultTableModel;
 import javax.swing.table.TableCellRenderer;
@@ -43,4 +45,9 @@
     private DefaultTableModel tableModel;
     private JTable colors;
+    private ArrayList<String> del = new ArrayList<String>();
+
+    JButton colorEdit;
+    JButton defaultSet;
+    JButton remove;
 
     /**
@@ -136,7 +143,60 @@
         setColorModel(Main.pref.getAllColors());
 
+        colorEdit = new JButton(tr("Choose"));
+        colorEdit.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                int sel = colors.getSelectedRow();
+                JColorChooser chooser = new JColorChooser((Color)colors.getValueAt(sel, 1));
+                int answer = JOptionPane.showConfirmDialog(gui, chooser,
+                tr("Choose a color for {0}", getName((String)colors.getValueAt(sel, 0))),
+                JOptionPane.OK_CANCEL_OPTION);
+                if (answer == JOptionPane.OK_OPTION)
+                    colors.setValueAt(chooser.getColor(), sel, 1);
+            }
+        });
+        defaultSet = new JButton(tr("Set to default"));
+        defaultSet.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                int sel = colors.getSelectedRow();
+                String name = (String)colors.getValueAt(sel, 0);
+                Color c = Main.pref.getDefaultColor(name);
+                if (c != null)
+                    colors.setValueAt(c, sel, 1);
+            }
+        });
+        JButton defaultAll = new JButton(tr("Set all to default"));
+        defaultAll.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                for(int i = 0; i < colors.getRowCount(); ++i)
+                {
+                  String name = (String)colors.getValueAt(i, 0);
+                  Color c = Main.pref.getDefaultColor(name);
+                  if (c != null)
+                      colors.setValueAt(c, i, 1);
+                }
+            }
+        });
+        remove = new JButton(tr("Remove"));
+        remove.addActionListener(new ActionListener(){
+            public void actionPerformed(ActionEvent e) {
+                int sel = colors.getSelectedRow();
+                del.add((String)colors.getValueAt(sel, 0));
+                tableModel.removeRow(sel);
+            }
+        });
+        remove.setEnabled(false);
+        colorEdit.setEnabled(false);
+        defaultSet.setEnabled(false);
+
         colors = new JTable(tableModel) {
             @Override public boolean isCellEditable(int row, int column) {
                 return false;
+            }
+            @Override public void valueChanged(ListSelectionEvent e) {
+                super.valueChanged(e);
+                int sel = colors.getSelectedRow();
+                remove.setEnabled(sel > 0 && isRemoveColor(sel));
+                colorEdit.setEnabled(sel > 0);
+                defaultSet.setEnabled(sel > 0);
             }
         };
@@ -155,47 +215,4 @@
         });
         colors.getColumnModel().getColumn(1).setWidth(100);
-
-        JButton colorEdit = new JButton(tr("Choose"));
-        colorEdit.addActionListener(new ActionListener(){
-            public void actionPerformed(ActionEvent e) {
-                if (colors.getSelectedRowCount() == 0) {
-                    JOptionPane.showMessageDialog(gui, tr("Please select a color."));
-                    return;
-                }
-                int sel = colors.getSelectedRow();
-                JColorChooser chooser = new JColorChooser((Color)colors.getValueAt(sel, 1));
-                int answer = JOptionPane.showConfirmDialog(gui, chooser,
-                tr("Choose a color for {0}", getName((String)colors.getValueAt(sel, 0))),
-                JOptionPane.OK_CANCEL_OPTION);
-                if (answer == JOptionPane.OK_OPTION)
-                    colors.setValueAt(chooser.getColor(), sel, 1);
-            }
-        });
-        JButton defaultSet = new JButton(tr("Set to default"));
-        defaultSet.addActionListener(new ActionListener(){
-            public void actionPerformed(ActionEvent e) {
-                if (colors.getSelectedRowCount() == 0) {
-                    JOptionPane.showMessageDialog(gui, tr("Please select a color."));
-                    return;
-                }
-                int sel = colors.getSelectedRow();
-                String name = (String)colors.getValueAt(sel, 0);
-                Color c = Main.pref.getDefaultColor(name);
-                if (c != null)
-                    colors.setValueAt(c, sel, 1);
-            }
-        });
-        JButton defaultAll = new JButton(tr("Set all to default"));
-        defaultAll.addActionListener(new ActionListener(){
-            public void actionPerformed(ActionEvent e) {
-                for(int i = 0; i < colors.getRowCount(); ++i)
-                {
-                  String name = (String)colors.getValueAt(i, 0);
-                  Color c = Main.pref.getDefaultColor(name);
-                  if (c != null)
-                      colors.setValueAt(c, i, 1);
-                }
-            }
-        });
         colors.setToolTipText(tr("Colors used by different objects in JOSM."));
         colors.setPreferredScrollableViewportSize(new Dimension(100,112));
@@ -212,5 +229,11 @@
         buttonPanel.add(defaultSet, GBC.std().insets(5,5,5,0));
         buttonPanel.add(defaultAll, GBC.std().insets(0,5,0,0));
+        buttonPanel.add(remove, GBC.std().insets(0,5,0,0));
         gui.displaycontent.addTab(tr("Colors"), panel);
+    }
+
+    Boolean isRemoveColor(int row)
+    {
+        return ((String)colors.getValueAt(row, 0)).startsWith("layer ");
     }
 
@@ -227,4 +250,6 @@
     public boolean ok() {
         Boolean ret = false;
+        for(String d : del)
+            Main.pref.put("color."+d, null);
         for (int i = 0; i < colors.getRowCount(); ++i) {
             String key = (String)colors.getValueAt(i, 0);
