60 lines
2.6 KiB
C#
60 lines
2.6 KiB
C#
using System;
|
|
|
|
namespace RedisManager.Utils
|
|
{
|
|
/// <summary>
|
|
/// Utility class for formatting console output with ANSI color codes.
|
|
/// Provides methods to wrap text with different colors for enhanced readability.
|
|
/// </summary>
|
|
public static class Output
|
|
{
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI green color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with green ANSI color codes</returns>
|
|
public static string Green(string text) => $"\u001b[32m{text}\u001b[0m";
|
|
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI red color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with red ANSI color codes</returns>
|
|
public static string Red(string text) => $"\u001b[31m{text}\u001b[0m";
|
|
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI yellow color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with yellow ANSI color codes</returns>
|
|
public static string Yellow(string text) => $"\u001b[33m{text}\u001b[0m";
|
|
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI blue color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with blue ANSI color codes</returns>
|
|
public static string Blue(string text) => $"\u001b[34m{text}\u001b[0m";
|
|
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI cyan color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with cyan ANSI color codes</returns>
|
|
public static string Cyan(string text) => $"\u001b[36m{text}\u001b[0m";
|
|
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI magenta color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with magenta ANSI color codes</returns>
|
|
public static string Magenta(string text) => $"\u001b[35m{text}\u001b[0m";
|
|
|
|
/// <summary>
|
|
/// Wraps the specified text with ANSI white color codes.
|
|
/// </summary>
|
|
/// <param name="text">The text to colorize</param>
|
|
/// <returns>The text wrapped with white ANSI color codes</returns>
|
|
public static string White(string text) => $"\u001b[37m{text}\u001b[0m";
|
|
}
|
|
} |