Java Color to RGB String toRGB(Color c)

Here you can find the source of toRGB(Color c)

Description

convert this color as "rgb(red,green,blue)"

License

Open Source License

Parameter

Parameter Description
c the color

Return

null if c is null or the rgb string

Declaration

public static String toRGB(Color c) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;

public class Main {
    /**/*  w ww.j  ava  2s  . c o  m*/
     * convert this color as "rgb(red,green,blue)"
     * @param c the color
     * @return null if c is null or the rgb string
     */
    public static String toRGB(Color c) {
        if (c == null)
            return null;
        return "rgb(" + c.getRed() + "," + c.getGreen() + "," + c.getBlue() + ")";
    }
}

Related

  1. colourToRgbString(Color colour)
  2. colourToString(Color colour)
  3. colourToString(java.awt.Color c)
  4. toRGB(Color color)
  5. toRGB(ColorSpace colorSpace, float... components)
  6. toRGB(int red, int green, int blue)
  7. toRGB565(Color c)