Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Color[] ToColorArray(string str)
- {
- int NumberChars = str.Length;
- Color[] colors = new Color[NumberChars / 6];
- for (int i = 0; i < NumberChars; i += 6)
- {
- float r = System.Convert.ToInt32(str.Substring(i, 2), 16);
- float g = System.Convert.ToInt32(str.Substring(i+2, 2), 16);
- float b = System.Convert.ToInt32(str.Substring(i+4, 2), 16);
- colors[i / 6] = new Color(r, g, b);
- }
- return colors;
- }
Advertisement
Add Comment
Please, Sign In to add comment