Index: trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java	(revision 7135)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java	(revision 7136)
@@ -55,5 +55,13 @@
             color = c.get(FILL_COLOR, null, Color.class);
             if (color != null) {
-                int alpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fillalpha", 50))));
+                int alpha = color.getAlpha();
+                if (alpha == 255) {
+                    // Assume alpha value has not been specified by the user if
+                    // is set to fully opaque. Use default value in this case.
+                    // It is not an ideal solution, but a little tricky to get this
+                    // right, especially as named map colors can be changed in
+                    // the preference GUI and written to the preferences file.
+                    alpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fillalpha", 50))));
+                }
                 Integer pAlpha = Utils.color_float2int(c.get(FILL_OPACITY, null, float.class));
                 if (pAlpha != null) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 7135)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java	(revision 7136)
@@ -24,4 +24,5 @@
         c.put(WIDTH, Keyword.DEFAULT);
         c.put(COLOR, color != null ? color : PaintColors.UNTAGGED.get());
+        c.put(OPACITY, 1f);
         if (isAreaEdge) {
             c.put(Z_INDEX, -3f);
@@ -169,5 +170,9 @@
         }
 
+        int alpha = 255;
         Color color = c.get(type.prefix + COLOR, null, Color.class);
+        if (color != null) {
+            alpha = color.getAlpha();
+        }
         if (type == LineType.NORMAL && color == null) {
             color = c.get(FILL_COLOR, null, Color.class);
@@ -177,5 +182,4 @@
         }
 
-        int alpha = 255;
         Integer pAlpha = Utils.color_float2int(c.get(type.prefix + OPACITY, null, Float.class));
         if (pAlpha != null) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java	(revision 7135)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java	(revision 7136)
@@ -216,7 +216,9 @@
         Stroke stroke = null;
         if (strokeColor != null) {
-            float strokeAlpha = c.get("symbol-stroke-opacity", 1f, Float.class);
-            strokeColor = new Color(strokeColor.getRed(), strokeColor.getGreen(),
-                    strokeColor.getBlue(), Utils.color_float2int(strokeAlpha));
+            Integer strokeAlpha = Utils.color_float2int(c.get("symbol-stroke-opacity", null, Float.class));
+            if (strokeAlpha != null) {
+                strokeColor = new Color(strokeColor.getRed(), strokeColor.getGreen(),
+                        strokeColor.getBlue(), strokeAlpha);
+            }
             stroke = new BasicStroke(strokeWidth);
         }
@@ -228,7 +230,9 @@
 
         if (fillColor != null) {
-            float fillAlpha = c.get("symbol-fill-opacity", 1f, Float.class);
-            fillColor = new Color(fillColor.getRed(), fillColor.getGreen(),
-                    fillColor.getBlue(), Utils.color_float2int(fillAlpha));
+            Integer fillAlpha = Utils.color_float2int(c.get("symbol-fill-opacity", null, Float.class));
+            if (fillAlpha != null) {
+                fillColor = new Color(fillColor.getRed(), fillColor.getGreen(),
+                        fillColor.getBlue(), fillAlpha);
+            }
         }
 
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 7135)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java	(revision 7136)
@@ -202,11 +202,17 @@
          */
         public static Color rgb(float r, float g, float b) {
-            Color c;
             try {
-                c = new Color(r, g, b);
+                return new Color(r, g, b);
             } catch (IllegalArgumentException e) {
                 return null;
             }
-            return c;
+        }
+        
+        public static Color rgba(float r, float g, float b, float alpha) {
+            try {
+                return new Color(r, g, b, alpha);
+            } catch (IllegalArgumentException e) {
+                return null;
+            }
         }
 
