Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { private static Map<String, String> colorToHexMap = new HashMap<String, String>(); public static String colorToHex(String color) { if (colorToHexMap.containsKey(color.toLowerCase())) { return colorToHexMap.get(color.toLowerCase()); } return color; } }