mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-25 04:32:51 +08:00

* Renames Style -> Decoration * Renames Appearance -> Style * Adds Style.Parse and Style.TryParse
30 lines
638 B
C#
30 lines
638 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Spectre.Console.Internal
|
|
{
|
|
internal static class StyleExtensions
|
|
{
|
|
public static Style Combine(this Style style, IEnumerable<Style> source)
|
|
{
|
|
if (style is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(style));
|
|
}
|
|
|
|
if (source is null)
|
|
{
|
|
return style;
|
|
}
|
|
|
|
var current = style;
|
|
foreach (var item in source)
|
|
{
|
|
current = current.Combine(item);
|
|
}
|
|
|
|
return current;
|
|
}
|
|
}
|
|
}
|