The less function "luma".

@param color
a color value as long
@return a value in the range from 0.0 to 1.0
541186
static double luma( double color ) {
        long argb = Double.doubleToRawLongBits( color );
        double r = ((argb >> 32) & 0xFFFF) / (double)0xFF00;
        double g = ((argb >> 16) & 0xFFFF) / (double)0xFF00;
        double b = ((argb) & 0xFFFF) / (double)0xFF00;

        r = (r <= 0.03928) ? r / 12.92 : Math.pow( ((r + 0.055) / 1.055), 2.4 );
        g = (g <= 0.03928) ? g / 12.92 : Math.pow( ((g + 0.055) / 1.055), 2.4 );
        b = (b <= 0.03928) ? b / 12.92 : Math.pow( ((b + 0.055) / 1.055), 2.4 );

        return 0.2126 * r + 0.7152 * g + 0.0722 * b;
    }
64739
function(color, alpha) {
            color = color.toRGB();
            alpha = Math.min(Math.max(alpha, 0), 1);
            var rgb = this.clone();

            rgb.red = (rgb.red * (1 - alpha)) + (color.red * alpha);
            rgb.green = (rgb.green * (1 - alpha)) + (color.green * alpha);
            rgb.blue = (rgb.blue * (1 - alpha)) + (color.blue * alpha);
            rgb.alpha = (rgb.alpha * (1 - alpha)) + (color.alpha * alpha);

            return rgb;
        }
600
function getColorLightenFunction(less) {

  function rgba() {
    var rgbaFunc = less.functions.functionRegistry.get("rgba");
    return rgbaFunc.apply(null, arguments);
  }

  return function (color, amount) {
    var baseRGB = [255, 255, 255];
    var value = amount.value / 100;

    if (value < 0) {
      baseRGB = [0, 0, 0];
      value = -1 * value;
    }

    return rgba(
      Math.round((baseRGB[0] - color.rgb[0]) * value) + color.rgb[0],
      Math.round((baseRGB[1] - color.rgb[1]) * value) + color.rgb[1],
      Math.round((baseRGB[2] - color.rgb[2]) * value) + color.rgb[2],
      color.alpha
    );
  };
}
376407
function getLab(color) {
    var xyz = getXYZ(color);

    var white = [ 95.047, 100.000, 108.883 ]; //for X, Y, Z

    var x = fromXYZValueToLabValue(xyz[0], white[0]);
    var y = fromXYZValueToLabValue(xyz[1], white[1]);
    var z = fromXYZValueToLabValue(xyz[2], white[2]);

    return [
        116 * y - 16,
        500 * (x - y),
        200 * (y - z)
    ]
}
826017
@ColorInt
    public static int opaqueColor(@ColorInt int color) {
        int alpha = Color.alpha(color);
        if (alpha == 0) return color;
        int red = Color.red(color);
        int green = Color.green(color);
        int blue = Color.blue(color);
        return Color.argb(255, red, green, blue);
    }
802109
private function relativeLuminosity(RGB $color)
    {
        $luminosity = 0.2126 * pow($color->getRed() / 255, 2.2) +
            0.7152 * pow($color->getGreen() / 255, 2.2) +
            0.0722 * pow($color->getBlue() / 255, 2.2);

        return $luminosity;
    }
1026300
public static GenericColor valueOf(Color color) {

    Objects.requireNonNull(color, "color");
    Red red = new Red(color.getRed());
    Green green = new Green(color.getGreen());
    Blue blue = new Blue(color.getBlue());
    Alpha alpha = new Alpha(color.getAlpha());
    return valueOf(red, green, blue, alpha);
  }
134770
private function DarkenColor($color, $amount)
    {
        $newColor = $color * (1 - $amount);
        return min(max(round($newColor), 0x00), 0xff);
    }
739691
public static int changeColorAlpha(int color, int alpha) {
        int r = (color >> 16) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int b = color & 0xFF;
        return alpha << 24 | r << 16 | g << 8 | b;
    }
521634
public DataRange color(String... colors) {
        if (colors == null || colors.length == 0) {
            return this;
        }
        this.color().addAll(Arrays.asList(colors));
        return this;
    }
1230880
protected Color desaturate(Color color) {
        float[] tmp = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);

        tmp[1] /= 3.0f;
        tmp[2] = clamp(1.0f - (1.0f - tmp[2]) / 3f);

        return new Color((Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF));
    }
129528
function(color) {
				if (!color || color === "") {
					return _colorLookup.black;
				} else if (_colorLookup[color]) {
					return _colorLookup[color];
				} else if (typeof(color) === "number") {
					return [color >> 16, (color >> 8) & 255, color & 255];
				} else if (color.charAt(0) === "#") {
					if (color.length === 4) { //for shorthand like #9F0
						color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3);
					}
					color = parseInt(color.substr(1), 16);
					return [color >> 16, (color >> 8) & 255, color & 255];
				} else {
					return color.match(_numExp) || _colorLookup.transparent;
				}
			}
56650
def _hue(color, **kwargs):
    
    h = colorsys.rgb_to_hls(*[x / 255.0 for x in color.value[:3]])[0]
    return NumberValue(h * 360.0)
722841
private function LightenColor($color, $amount)
    {
        $newColor = $color + (0xff - $color) * $amount;
        return min(max(round($newColor), 0x00), 0xff);
    }
695450
function desaturate(color, amount) {
    amount = (amount === 0) ? 0 : (amount || 10);
    var hsl = tinycolor(color).toHsl();
    hsl.s -= amount / 100;
    hsl.s = clamp01(hsl.s);
    return tinycolor(hsl);
}
1323320
private int adjustAlpha(int color, float factor) {
        int alpha = Math.round(Color.alpha(color) * factor);
        int red = Color.red(color);
        int green = Color.green(color);
        int blue = Color.blue(color);
        return Color.argb(alpha, red, green, blue);
    }
903240
@CheckReturnValue
    public RoleAction setColor(Color color)
    {
        return this.setColor(color != null ? color.getRGB() : null);
    }