Here you can find the source of colourToHtmlString(Color colour)
Parameter | Description |
---|---|
colour | The colour to represent as a String |
null
if a null
was supplied.
public static String colourToHtmlString(Color colour)
//package com.java2s; import java.awt.Color; public class Main { /**/*from w ww. ja v a 2s . c o m*/ * Converts a {@link Color} to an HTML {@link String} (#RRGGBB), ignoring * transparency. * * @param colour * The colour to represent as a {@link String} * @return The HTML representation of the {@link Color}, or * <code>null</code> if a <code>null</code> {@link Color} was * supplied. */ public static String colourToHtmlString(Color colour) { if (colour == null) { return null; } return String.format("#%06X", colour.getRGB() & 0x00FFFFFF); } }