AnsweredAssumed Answered

How to use ColorFactory to produce transparent colors for a ColorRamp?

Question asked by htudosieesri-ca-esridist Employee on Sep 29, 2016
Latest reply on Sep 30, 2016 by htudosieesri-ca-esridist

This is my code:

var colorRamp = new CIMFixedColorRamp();
var colors = new List();
foreach (var cls in classes)
{
    switch (cls.Label)
    {
        case "INSERT":
            colors.Add(DeltaLayer.ShapeType == esriGeometryType.esriGeometryPolygon
                ? ColorFactory.CreateRGBColor(0, 255, 0, 128) : ColorFactory.GreenRGB);
            break;
        case "DELETE":
            colors.Add(DeltaLayer.ShapeType == esriGeometryType.esriGeometryPolygon
                ? ColorFactory.CreateRGBColor(255, 0, 0, 128) : ColorFactory.RedRGB);
            break;
        default:
            colors.Add(ColorFactory.GreyRGB);
            break;
    }
}
colorRamp.Colors = colors.ToArray();

The goal is to produce an UniqueValueRenderer that will allow overlapping polygons to show distinct by using transparent colors.

As after line 20 the colors in the ramp looks like having some transparency:

 

The result in the property editor (and on the Map) does not reflect this:

Beside, the sliders near the Red and Blue value numeric boxes are very confusing: shouldn't they be read and blue?!

 

What is this?!

 

Note: the Transparency can be adjusted from this editor proving that the UniqueValueRender supports transparent colors, but it does not come as such from the code!

Outcomes