Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string ToRainbow (this string sourceText)
- {
- string finalText = "";
- foreach (char letter in sourceText)
- {
- Color randomColor = new Color(
- Random.Range(0.0f, 1.0f),
- Random.Range(0.0f, 1.0f),
- Random.Range(0.0f, 1.0f)
- );
- if (letter == ' '){
- finalText += letter;
- }
- else
- {
- finalText += string.Format("<color=#{0}>{1}</color>", randomColor.ToHex(), letter);
- }
- }
- return finalText;
- }
- public static string ToHex (this Color32 sourceColor)
- {
- string hex = sourceColor.r.ToString("X2") + sourceColor.g.ToString("X2") + sourceColor.b.ToString("X2");
- return hex;
- }
Advertisement
Add Comment
Please, Sign In to add comment