using System; using System.ComponentModel; namespace Spectre.Console { /// /// Contains extension methods for . /// public static class ObsoleteStyleExtensions { /// /// Creates a new style from the specified one with /// the specified foreground color. /// /// The style. /// The foreground color. /// The same instance so that multiple calls can be chained. [Obsolete("Use Foreground(..) instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public static Style WithForeground(this Style style, Color color) { if (style is null) { throw new ArgumentNullException(nameof(style)); } return new Style( foreground: color, background: style.Background, decoration: style.Decoration); } /// /// Creates a new style from the specified one with /// the specified background color. /// /// The style. /// The background color. /// The same instance so that multiple calls can be chained. [Obsolete("Use Background(..) instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public static Style WithBackground(this Style style, Color color) { if (style is null) { throw new ArgumentNullException(nameof(style)); } return new Style( foreground: style.Foreground, background: color, decoration: style.Decoration); } /// /// Creates a new style from the specified one with /// the specified text decoration. /// /// The style. /// The text decoration. /// The same instance so that multiple calls can be chained. [Obsolete("Use Decoration(..) instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public static Style WithDecoration(this Style style, Decoration decoration) { if (style is null) { throw new ArgumentNullException(nameof(style)); } return new Style( foreground: style.Foreground, background: style.Background, decoration: decoration); } /// /// Creates a new style from the specified one with /// the specified link. /// /// The style. /// The link. /// The same instance so that multiple calls can be chained. [Obsolete("Use Link(..) instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public static Style WithLink(this Style style, string link) { if (style is null) { throw new ArgumentNullException(nameof(style)); } return new Style( foreground: style.Foreground, background: style.Background, decoration: style.Decoration, link: link); } } }