Create a color value.

@param hue
hue value
@param saturation
saturation
@param value
the value
@param alpha
alpha
@return a color value as long
492682
static double hsva( double hue, double saturation, double value, double alpha ) {
        hue = ((hue % 360) / 360) * 360;

        int i = (int)Math.floor( (hue / 60) % 6 );
        double f = (hue / 60) - i;

        double[] vs = { value, value * (1 - saturation), value * (1 - f * saturation), value * (1 - (1 - f) * saturation) };

        return rgba( vs[HSVA_PERM[i][0]] * 255, vs[HSVA_PERM[i][1]] * 255, vs[HSVA_PERM[i][2]] * 255, alpha );
    }
400459
def color(self, color):
        
        self._color = color
        self.saturation = saturation_of_color(color)
        if self.saturation != 0:
            self.hue = hue_of_color(color)
1360375
function(ui)
              {
                switch (settings.color.mode)
                {
                  case 'h':
                    var a = ui.val('a');
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (a || 0)) * 100) / 255, 4));
                    break;
                  case 's':
                    var hva = ui.val('hva'),
                        saturatedColor = new Color({ h: hva && hva.h || 0, s: 100, v: hva != null ? hva.v : 100 });
                    setBG.call($this, colorBarDiv, saturatedColor.val('hex'));
                    setAlpha.call($this, colorBarL2, 100 - (hva != null ? hva.v : 100));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hva && hva.a || 0)) * 100) / 255, 4));
                    break;
                  case 'v':
                    var hsa = ui.val('hsa'),
                        valueColor = new Color({ h: hsa && hsa.h || 0, s: hsa != null ? hsa.s : 100, v: 100 });
                    setBG.call($this, colorBarDiv, valueColor.val('hex'));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hsa && hsa.a || 0)) * 100) / 255, 4));
                    break;
                  case 'r':
                  case 'g':
                  case 'b':
                    var hValue = 0, vValue = 0, rgba = ui.val('rgba');
                    if (settings.color.mode == 'r')
                    {
                      hValue = rgba && rgba.b || 0;
                      vValue = rgba && rgba.g || 0;
                    }
                    else if (settings.color.mode == 'g')
                    {
                      hValue = rgba && rgba.b || 0;
                      vValue = rgba && rgba.r || 0;
                    }
                    else if (settings.color.mode == 'b')
                    {
                      hValue = rgba && rgba.r || 0;
                      vValue = rgba && rgba.g || 0;
                    }
                    var middle = vValue > hValue ? hValue : vValue;
                    setAlpha.call($this, colorBarL2, hValue > vValue ? Math.precision(((hValue - vValue) / (255 - vValue)) * 100, 4) : 0);
                    setAlpha.call($this, colorBarL3, vValue > hValue ? Math.precision(((vValue - hValue) / (255 - hValue)) * 100, 4) : 0);
                    setAlpha.call($this, colorBarL4, Math.precision((middle / 255) * 100, 4));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (rgba && rgba.a || 0)) * 100) / 255, 4));
                    break;
                  case 'a':
                    var a = ui.val('a');
                    setBG.call($this, colorBarDiv, ui.val('hex') || '000000');
                    setAlpha.call($this, colorBarL5, a != null ? 0 : 100);
                    setAlpha.call($this, colorBarL6, a != null ? 100 : 0);
                    break;
                }
              }
683334
public static function hsla(Color $color, float $alpha = 1.0)
    {
        $hsl = $color->getHsl();

        return sprintf(
            'hsla(%s, %s%%, %s%%, %s)',
            sprintf('%0.1f', $hsl['h'] * 360) + 0,
            sprintf('%0.1f', $hsl['s'] * 100) + 0,
            sprintf('%0.1f', $hsl['l'] * 100) + 0,
            $alpha + 0
        );
    }
546085
function brightColor(layerId, alpha) {
  var luminosity = 'bright';
  var hue = null;

  if (/water|ocean|lake|sea|river/.test(layerId)) {
    hue = 'blue';
  }

  if (/state|country|place/.test(layerId)) {
    hue = 'pink';
  }

  if (/road|highway|transport/.test(layerId)) {
    hue = 'orange';
  }

  if (/contour|building/.test(layerId)) {
    hue = 'monochrome';
  }

  if (/building/.test(layerId)) {
    luminosity = 'dark';
  }

  if (/contour|landuse/.test(layerId)) {
    hue = 'yellow';
  }

  if (/wood|forest|park|landcover/.test(layerId)) {
    hue = 'green';
  }

  var rgb = randomColor({
    luminosity: luminosity,
    hue: hue,
    seed: layerId,
    format: 'rgbArray'
  });

  var rgba = rgb.concat([alpha || 1]);
  return 'rgba(' + rgba.join(', ') + ')';
}
935354
public static Color HSVtoRGB (float h, float s, float v, float alpha) {
		Color c = HSVtoRGB(h, s, v);
		c.a = alpha;
		return c;
	}
70429
public static String fill(int color) {
    final String colorCode = Integer.toHexString(color & 0xFFFFFF); // Strip alpha
    return FILTER_FILL + "(" + colorCode + ")";
  }
288883
public void setLayerOpacity(int alpha, int layer) {

        if ((alpha >= 0) && (alpha <= 100) && isAttached()) {
            Element colorbar;

            switch (layer) {
                case COLORBAR_A:
                    colorbar = m_colorA.getElement();
                    break;
                case COLORBAR_B:
                    colorbar = m_colorB.getElement();
                    break;
                case COLORBAR_C:
                    colorbar = m_colorC.getElement();
                    break;
                case COLORBAR_D:
                    colorbar = m_colorD.getElement();
                    break;
                default:
                    return;
            }
            colorbar.getStyle().setOpacity((1.0 * alpha) / 100);
            CmsTransparencyImpl.setTransparency(colorbar, alpha);
        }
    }
585463
public static Color[] jet(int n, float alpha) {
        int m = (int) Math.ceil(n / 4);

        float[] u = new float[3 * m];
        for (int i = 0; i < u.length; i++) {
            if (i == 0) {
                u[i] = 0.0f;
            } else if (i <= m) {
                u[i] = i / (float) m;
            } else if (i <= 2 * m - 1) {
                u[i] = 1.0f;
            } else {
                u[i] = (3 * m - i) / (float) m;
            }

        }

        int m2 = m / 2 + m % 2;
        int mod = n % 4;
        int[] r = new int[n];
        int[] g = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < u.length - 1; i++) {
            if (m2 - mod + i < n) {
                g[m2 - mod + i] = i + 1;
            }
            if (m2 - mod + i + m < n) {
                r[m2 - mod + i + m] = i + 1;
            }
            if (i > 0 && m2 - mod + i < u.length) {
                b[i] = m2 - mod + i;
            }
        }

        Color[] palette = new Color[n];
        for (int i = 0; i < n; i++) {
            palette[i] = new Color(u[r[i]], u[g[i]], u[b[i]], alpha);
        }

        return palette;
    }
316591
public static Color rgbToColorConverter(final String value) {

        if (StringUtils.isEmpty(value) || (!StringUtils.isEmpty(value) && !value.startsWith("rgb"))) {
            throw new IllegalArgumentException(
                    "String to convert is empty or of invalid format - value: '" + value + "'");
        }

        // RGB color format rgb/rgba(255,255,255,0.1)
        final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
        final int red = Integer.parseInt(colors[0]);
        final int green = Integer.parseInt(colors[1]);
        final int blue = Integer.parseInt(colors[2]);
        if (colors.length > 3) {
            final int alpha = (int) (Double.parseDouble(colors[3]) * 255D);
            return new Color(red, green, blue, alpha);
        }
        return new Color(red, green, blue);
    }
537073
public static Color[] redgreen(int n, float alpha) {
        Color[] palette = new Color[n];
        for (int i = 0; i < n; i++) {
            palette[i] = new Color((float) Math.sqrt((i + 1.0f) / n), (float) Math.sqrt(1 - (i + 1.0f) / n), 0.0f, alpha);
        }

        return palette;
    }
705031
function brighten(alpha) {
		if (isNumber(alpha) && alpha !== 0) {
			var i;
			for (i = 0; i < 3; i++) {
				rgba[i] += pInt(alpha * 255);

				if (rgba[i] < 0) {
					rgba[i] = 0;
				}
				if (rgba[i] > 255) {
					rgba[i] = 255;
				}
			}
		}
		return this;
	}
697605
def set_map_alpha(alpha):
    
    if alpha < 0 or alpha > 255:
        raise Exception('invalid alpha '  + str(alpha))
    _global_config.map_alpha = alpha
446503
private static int setColorAlpha(int color, byte alpha) {
    return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
  }
213505
function Hue() {
        Channel.apply(this, arguments);
        this.dataType = NUMBER | HUE;
        this.cssType = NUMBER;
        this.range = [0, 360];
        this.filter = MOD;
        this.initial = 0;
    }
1371161
public static void setAlpha(final Actor actor, final float alpha) {
        if (actor != null) {
            actor.getColor().a = alpha;
        }
    }
678523
public void setPointerAlpha(int alpha) {
        if (alpha >= 0 && alpha <= 255) {
            mPointerAlpha = alpha;
            mPointerHaloPaint.setAlpha(mPointerAlpha);
            invalidate();
        }
    }