Skip to content

Instantly share code, notes, and snippets.

@peroon
Created December 5, 2016 00:39
Show Gist options
  • Select an option

  • Save peroon/25baa5818c99dc12517cdc89616eaaf7 to your computer and use it in GitHub Desktop.

Select an option

Save peroon/25baa5818c99dc12517cdc89616eaaf7 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System;
using System.Linq;
using System.Collections.Generic;
namespace DL
{
/// <summary>
/// MonoBehaviourの拡張クラス
/// </summary>
public static partial class Extensions
{
/// <summary>
/// 指定した色の着色情報をつける
/// </summary>
/// <param name="color">色文字列</param>
/// <returns><カラー付与出力文字列/returns>
public static string Coloring(this string iSelf , string iColor)
{
return string.Format("<color={0}>{1}</color>" , iColor , iSelf);
}
/// <summary>
/// 赤色の着色情報をつける
/// </summary>
/// <param name="iString">入力文字列</param>
/// <returns><カラー付与出力文字列/returns>
public static string Red(this string iSelf)
{
return iSelf.Coloring("red");
}
/// <summary>
/// 緑色の着色情報をつける
/// </summary>
/// <returns>カラー付与出力文字列</returns>
public static string Green(this string iSelf)
{
return iSelf.Coloring("green");
}
/// <summary>
/// 青色の着色情報をつける
/// </summary>
/// <returns>カラー付与出力文字列</returns>
public static string Blue(this string iSelf)
{
return iSelf.Coloring("blue");
}
/// <summary>
/// シアン色の着色情報をつける
/// </summary>
/// <returns>カラー付与出力文字列</returns>
public static string Cyan(this string iSelf)
{
return iSelf.Coloring("cyan");
}
/// <summary>
/// マゼンタ色の着色情報をつける
/// </summary>
/// <returns>カラー付与出力文字列</returns>
public static string Magenta(this string iSelf)
{
return iSelf.Coloring("magenta");
}
/// <summary>
/// 黄色の着色情報をつける
/// </summary>
/// <returns>カラー付与出力文字列</returns>
public static string Yellow(this string iSelf)
{
return iSelf.Coloring("yellow");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment