Java Color to Hex toHexColor(Color col)

Here you can find the source of toHexColor(Color col)

Description

to Hex Color

License

GNU General Public License

Declaration

public static String toHexColor(Color col) 

Method Source Code


//package com.java2s;
/*//from  w  w  w  . j  av  a 2 s.com
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 * Created on May 20, 2010
 * Author: Andreas Prlic
 *
 */

import java.awt.*;

public class Main {
    public static String toHexColor(Color col) {
        return Integer.toHexString((col.getRGB() & 0xffffff) | 0x1000000).substring(1);
    }
}

Related

  1. toHex(Color color)
  2. toHex(java.awt.Color color)
  3. toHex0x(Color col)
  4. toHexCode(String prefix, Color color)
  5. toHexColor(Color col)
  6. toHexColor(final Color color)
  7. toHexColor(final Color color)
  8. toHexString(Color c)
  9. toHexString(Color col)