mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							bde61cc6ff
						
					
				
				
					commit
					a59e0dcb21
				
			
							
								
								
									
										27
									
								
								src/Spectre.Console/Extensions/FigletTextExtensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/Spectre.Console/Extensions/FigletTextExtensions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace Spectre.Console
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Contains extension methods for <see cref="FigletText"/>.
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public static class FigletTextExtensions
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Sets the color of the FIGlet text.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="text">The text.</param>
 | 
			
		||||
        /// <param name="color">The color.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static FigletText Color(this FigletText text, Color? color)
 | 
			
		||||
        {
 | 
			
		||||
            if (text is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            text.Color = color ?? Console.Color.Default;
 | 
			
		||||
            return text;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user