Java Color to Hex toHex(Color color)

Here you can find the source of toHex(Color color)

Description

to Hex

License

Open Source License

Declaration

public static String toHex(Color color) 

Method Source Code

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

import java.awt.*;

public class Main {
    public static String toHex(Color color) {
        return "#" + String.format("%02X", color.getRed()).toLowerCase()
                + String.format("%02X", color.getGreen()).toLowerCase()
                + String.format("%02X", color.getBlue()).toLowerCase();
    }//from w w w . j a v a  2 s .  c o  m
}

Related

  1. toHex(Color c)
  2. toHex(Color color)
  3. toHex(Color color)
  4. toHex(Color color)
  5. toHex(Color color)
  6. toHex(Color color)
  7. toHex(java.awt.Color color)