/** * Converts the given Value and opacity to a Color object. * * @param c The CSS color to convert. * @param opacity The opacity value (0 <= o <= 1). */ public static Color convertColor(Value c, float opacity) { int r = resolveColorComponent(c.getRed()); int g = resolveColorComponent(c.getGreen()); int b = resolveColorComponent(c.getBlue()); return new Color(r, g, b, Math.round(opacity * 255f)); }