-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ec757e
commit 67292f5
Showing
3 changed files
with
60 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Collections.Immutable; | ||
using MonorailCss.Css; | ||
|
||
namespace MonorailCss.Plugins.Svg; | ||
|
||
/// <summary> | ||
/// The fill plugin. | ||
/// </summary> | ||
public class Stroke : BaseUtilityNamespacePlugin | ||
{ | ||
private const string Namespace = "stroke"; | ||
private readonly DesignSystem _designSystem; | ||
private readonly ImmutableDictionary<string, CssColor> _flattenedColors; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Stroke"/> class. | ||
/// </summary> | ||
/// <param name="designSystem">The design system.</param> | ||
public Stroke(DesignSystem designSystem) | ||
{ | ||
_designSystem = designSystem; | ||
_flattenedColors = designSystem.Colors.Flatten(); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override CssNamespaceToPropertyMap NamespacePropertyMapList => new() { { Namespace, "stroke" } }; | ||
|
||
/// <inheritdoc /> | ||
protected override CssSuffixToValueMap Values | ||
{ | ||
get => | ||
_flattenedColors.ToImmutableDictionary(k => k.Key, v => v.Value.AsRgb()).AddRange( | ||
new Dictionary<string, string> | ||
{ | ||
{ "inherit", "inherit" }, | ||
{ "current", "currentColor" }, | ||
{ "transparent", "transparent" }, | ||
{ "black", "#000" }, | ||
{ "white", "#000" }, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections.Immutable; | ||
|
||
namespace MonorailCss.Plugins.Svg; | ||
|
||
/// <summary> | ||
/// The stroke-width plugin. | ||
/// </summary> | ||
public class StrokeWidth : BaseUtilityPlugin | ||
{ | ||
/// <inheritdoc /> | ||
protected override string Property => "stroke-width"; | ||
|
||
/// <inheritdoc /> | ||
protected override ImmutableDictionary<string, string> Utilities => new Dictionary<string, string>() | ||
{ | ||
{ "stroke-0", "0" }, { "stroke-1", "1" }, { "stroke-2", "2" }, | ||
}.ToImmutableDictionary(); | ||
} |