public class ColorConverter
    {
     public static string GetHexFromRGB(string R, string G, string B)
     {
     string result = "";
     result += GetHex(Math.Floor(int.Parse(R) / 16)) + GetHex(Math.Floor(int.Parse(R) / 16))
     + GetHex(Math.Floor(int.Parse(G) / 16)) + GetHex(int.Parse(G) % 16)
     + GetHex(Math.Floor(int.Parse(B) / 16)) + GetHex(int.Parse(B) % 16);
     return result;
     }
     private static string GetHex(double Dec)
     {
     string Value = "";
     char c = 'A';
     if (Dec >= 10 && Dec <= 15)
     {
     c += (char)(Dec - 10);
     Value += c;
     }
     else Value = "" + Dec;
     return Value;
     }
    }