Remove verbs from extension methods

Removed the verbs from all extension methods that manipulate
properties which makes the API more succinct and easier to read.

Also added implicit conversion from string to Style.

As a good OSS citizen, I've obsoleted the old methods with
a warning for now, so this shouldn't break anyone using
the old methods.
This commit is contained in:
Patrik Svensson
2020-10-22 00:32:07 +02:00
committed by Patrik Svensson
parent 037a215a78
commit 041bd016a2
53 changed files with 1021 additions and 245 deletions

View File

@@ -61,6 +61,7 @@ namespace Spectre.Console
/// </summary>
/// <param name="color">The foreground color.</param>
/// <returns>A new <see cref="Style"/> with the specified foreground color.</returns>
[Obsolete("Use ctor(..) instead")]
public static Style WithForeground(Color color)
{
return new Style(foreground: color);
@@ -71,6 +72,7 @@ namespace Spectre.Console
/// </summary>
/// <param name="color">The background color.</param>
/// <returns>A new <see cref="Style"/> with the specified background color.</returns>
[Obsolete("Use ctor(..) instead")]
public static Style WithBackground(Color color)
{
return new Style(background: color);
@@ -81,6 +83,7 @@ namespace Spectre.Console
/// </summary>
/// <param name="decoration">The text decoration.</param>
/// <returns>A new <see cref="Style"/> with the specified text decoration.</returns>
[Obsolete("Use ctor(..) instead")]
public static Style WithDecoration(Decoration decoration)
{
return new Style(decoration: decoration);
@@ -91,6 +94,7 @@ namespace Spectre.Console
/// </summary>
/// <param name="link">The link.</param>
/// <returns>A new <see cref="Style"/> with the specified link.</returns>
[Obsolete("Use ctor(..) instead")]
public static Style WithLink(string link)
{
return new Style(link: link);
@@ -143,7 +147,7 @@ namespace Spectre.Console
/// </summary>
/// <param name="style">The style string.</param>
[SuppressMessage("Usage", "CA2225:Operator overloads have named alternates")]
public static explicit operator Style(string style)
public static implicit operator Style(string style)
{
return Parse(style);
}