Created
June 16, 2014 18:32
-
-
Save liortal53/86ab18cbdfb56f83d3bf to your computer and use it in GitHub Desktop.
Unity Debug.Log Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public enum Colors | |
{ | |
aqua, | |
black, | |
blue, | |
brown, | |
cyan, | |
darkblue, | |
fuchsia, | |
green, | |
grey, | |
lightblue, | |
lime, | |
magenta, | |
maroon, | |
navy, | |
olive, | |
purple, | |
red, | |
silver, | |
teal, | |
white, | |
yellow | |
} | |
public static class StringLoggingExtensions | |
{ | |
/// <summary> | |
/// Sets the color of the text according to the parameter value. | |
/// </summary> | |
/// <param name="message">Message.</param> | |
/// <param name="color">Color.</param> | |
public static string Colored(this string message, Colors color) | |
{ | |
return string.Format("<color={0}>{1}</color>", color.ToString(), message); | |
} | |
/// <summary> | |
/// Sets the color of the text according to the traditional HTML format parameter value. | |
/// </summary> | |
/// <param name="message">Message</param> | |
/// <param name="color">Color</param> | |
public static string Colored(this string message, string colorCode) | |
{ | |
return string.Format("<color={0}>{1}</color>", colorCode, message); | |
} | |
/// <summary> | |
/// Sets the size of the text according to the parameter value, given in pixels. | |
/// </summary> | |
/// <param name="message">Message.</param> | |
/// <param name="size">Size.</param> | |
public static string Sized(this string message, int size) | |
{ | |
return string.Format ("<size={0}>{1}</size>", size, message); | |
} | |
/// <summary> | |
/// Renders the text in boldface. | |
/// </summary> | |
/// <param name="message">Message.</param> | |
public static string Bold(this string message) | |
{ | |
return string.Format ("<b>{0}</b>", message); | |
} | |
/// <summary> | |
/// Renders the text in italics. | |
/// </summary> | |
/// <param name="message">Message.</param> | |
public static string Italics(this string message) | |
{ | |
return string.Format ("<i>{0}</i>", message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment