public static RichTextPointer Rainbow(this RichTextPointer pointer, bool threadSafe = false) { var str = pointer.str; System.Text.StringBuilder sb; if (threadSafe) { sb = new System.Text.StringBuilder(str.Length + bold.Length + unbold.Length); } else { sb = m_SB; sb.Clear(); } int strCount = str.Length; var rnbw = m_Rainbow; int rnbwCount = rnbw.Length; for (int i = 0; i < strCount; ++i) { sb.Append(colorize1); sb.Append('#'); sb.Append(ColorUtility.ToHtmlStringRGB(rnbw[i % rnbwCount])); sb.Append(colorize2); sb.Append(str[i]); sb.Append(uncolorize); } return(new RichTextPointer { str = sb.ToString() }); }
public static RichTextPointer Underline(this RichTextPointer pointer, bool threadSafe = false) { var str = pointer.str; StringBuilder sb; if (threadSafe) { sb = new StringBuilder(str.Length + underline.Length + ununderline.Length); } else { sb = m_SB; sb.Clear(); } sb.Append(underline); sb.Append(str); sb.Append(ununderline); return(new RichTextPointer { str = sb.ToString() }); }
public static RichTextPointer Colorize(this RichTextPointer pointer, Color color, bool threadSafe = false) { var str = pointer.str; StringBuilder sb; if (threadSafe) { sb = new StringBuilder(str.Length + colorize1.Length + colorize2.Length + uncolorize.Length + 7); } else { sb = m_SB; sb.Clear(); } sb.Append(colorize1); sb.Append('#'); sb.Append(ColorUtility.ToHtmlStringRGB(color)); sb.Append(colorize2); sb.Append(str); sb.Append(uncolorize); return(new RichTextPointer { str = sb.ToString() }); }
public static RichTextPointer InTeal(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(0, 128, 128, 255), threadSafe);
public static RichTextPointer InYellow(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(255, 0, 255, 255), threadSafe);
public static RichTextPointer InSilver(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(192, 192, 192, 255), threadSafe);
public static RichTextPointer InOchre(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(204, 119, 34, 255), threadSafe);
public static RichTextPointer InMustard(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(255, 219, 88, 255), threadSafe);
public static RichTextPointer InMaroon(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(128, 0, 0, 255), threadSafe);
public static RichTextPointer InBrown(this RichTextPointer pointer, bool threadSafe = false) => pointer.Colorize(new Color32(150, 75, 0, 255), threadSafe);