public static string ToHex(this Gdk.Color color) { return string.Format( "#{0:X2}{1:X2}{2:X2}", (int)Math.Truncate(color.Red / 256.00), (int)Math.Truncate(color.Green / 256.00), (int)Math.Truncate(color.Blue / 256.00)); }