[IMPL] Added RGB to Hex Conversion
This commit is contained in:
parent
cac788b6a6
commit
36b9715e9d
1 changed files with 21 additions and 7 deletions
|
|
@ -505,6 +505,20 @@ public static class UniversalExtensions
|
|||
var min = colors.Min(x => x.Diff);
|
||||
return colors.Find(x => x.Diff == min).Value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert RGB Value to Hex
|
||||
/// </summary>
|
||||
/// <param name="R">Red</param>
|
||||
/// <param name="G">Green</param>
|
||||
/// <param name="B">Blue</param>
|
||||
/// <returns>A string that represents the color in hex (e.g. 255, 0, 0 -> #FF0000)</returns>
|
||||
private static string ToHex(int R, int G, int B)
|
||||
{
|
||||
return "#" + R.ToString("X2") + G.ToString("X2") + B.ToString("X2");
|
||||
}
|
||||
}
|
||||
|
||||
public static class StringExt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue