private static Color fromRGB(final float r, final float g, final float b) { return new Color((int) (r * 255 + 0.5), (int) (g * 255 + 0.5), (int) (b * 255 + 0.5)); }
private static Color fromRGB(final float r, final float g, final float b) { return new Color((int) (r * 255 + 0.5), (int) (g * 255 + 0.5), (int) (b * 255 + 0.5)); }
public static Color fromRGB(final int r, final int g, final int b) { return new Color(r, g, b); }
public static Color fromRGB(final int r, final int g, final int b) { return new Color(r, g, b); }
public static Color fromHexTriplet(final String htmlColor) { if (isBlank(htmlColor)) { throw new IllegalArgumentException("No color provided, " + htmlColor); } if (htmlColor.length() != 7 || !htmlColor.startsWith("#")) { throw new IllegalArgumentException("Bad color provided, " + htmlColor); } // Parse color try { final int r = Integer.parseInt(htmlColor.substring(1, 3), 16); final int b = Integer.parseInt(htmlColor.substring(3, 5), 16); final int g = Integer.parseInt(htmlColor.substring(5, 7), 16); return new Color(r, b, g); } catch (final Exception e) { throw new IllegalArgumentException("Bad color provided, " + htmlColor, e); } }
public static Color fromHexTriplet(final String htmlColor) { if (isBlank(htmlColor)) { throw new IllegalArgumentException("No color provided, " + htmlColor); } if (htmlColor.length() != 7 || !htmlColor.startsWith("#")) { throw new IllegalArgumentException("Bad color provided, " + htmlColor); } // Parse color try { final int r = Integer.parseInt(htmlColor.substring(1, 3), 16); final int b = Integer.parseInt(htmlColor.substring(3, 5), 16); final int g = Integer.parseInt(htmlColor.substring(5, 7), 16); return new Color(r, b, g); } catch (final Exception e) { throw new IllegalArgumentException("Bad color provided, " + htmlColor, e); } }
private static Color fromRGB(final float r, final float g, final float b) { return new Color((int) (r * 255 + 0.5), (int) (g * 255 + 0.5), (int) (b * 255 + 0.5)); }
private static Color fromRGB(final float r, final float g, final float b) { return new Color((int) (r * 255 + 0.5), (int) (g * 255 + 0.5), (int) (b * 255 + 0.5)); }
public static Color fromRGB(final int r, final int g, final int b) { return new Color(r, g, b); }
public static Color fromRGB(final int r, final int g, final int b) { return new Color(r, g, b); }
public static Color fromHexTriplet(final String htmlColor) { if (isBlank(htmlColor)) { throw new IllegalArgumentException("No color provided, " + htmlColor); } if (htmlColor.length() != 7 || !htmlColor.startsWith("#")) { throw new IllegalArgumentException("Bad color provided, " + htmlColor); } // Parse color try { final int r = Integer.parseInt(htmlColor.substring(1, 3), 16); final int b = Integer.parseInt(htmlColor.substring(3, 5), 16); final int g = Integer.parseInt(htmlColor.substring(5, 7), 16); return new Color(r, b, g); } catch (final Exception e) { throw new IllegalArgumentException("Bad color provided, " + htmlColor, e); } }
public static Color fromHexTriplet(final String htmlColor) { if (isBlank(htmlColor)) { throw new IllegalArgumentException("No color provided, " + htmlColor); } if (htmlColor.length() != 7 || !htmlColor.startsWith("#")) { throw new IllegalArgumentException("Bad color provided, " + htmlColor); } // Parse color try { final int r = Integer.parseInt(htmlColor.substring(1, 3), 16); final int b = Integer.parseInt(htmlColor.substring(3, 5), 16); final int g = Integer.parseInt(htmlColor.substring(5, 7), 16); return new Color(r, b, g); } catch (final Exception e) { throw new IllegalArgumentException("Bad color provided, " + htmlColor, e); } }