A fun solution was to create a string hash using the name of the item, and then use the first three bytes of the string as RGB values to style the item with inline CSS.
var md5Gen = System.Security.Cryptography.MD5.Create(); byte[] hash = md5Gen.ComputeHash(System.Text.Encoding.UTF8.GetBytes(myItem.Name)); string hexColour = string.Format("#{0:X}{1:X}{2:X}", hash[0], hash[1], hash[2]);
No comments:
Post a Comment
Comments are very welcome but are moderated to prevent spam.