Skip to content

Commit 0ba8fd1

Browse files
committed
Added a constructor argument to get the variant if available.
1 parent fe2e58c commit 0ba8fd1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ColorSetKit/Color.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,31 @@ namespace ColorSetKit
3434
[MarkupExtensionReturnType( typeof( SolidColorBrush ) )]
3535
public partial class Color: MarkupExtension
3636
{
37-
public Color( string name )
37+
public Color( string name ): this( name, false )
38+
{}
39+
40+
public Color( string name, bool variant )
3841
{
39-
this.Name = name;
42+
this.Name = name;
43+
this.Variant = variant;
4044
}
4145

4246
public override object ProvideValue( IServiceProvider provider )
4347
{
44-
return ColorSet.Shared.ColorNamed( this.Name )?.Color;
48+
ColorPair color = ColorSet.Shared.ColorNamed( this.Name );
49+
50+
return this.Variant && color?.Variant is SolidColorBrush variant ? variant : color?.Color;
4551
}
4652

4753
[ConstructorArgument( "name" )]
4854
public string Name
55+
{
56+
get;
57+
set;
58+
}
59+
60+
[ConstructorArgument( "variant" )]
61+
public bool Variant
4962
{
5063
get;
5164
set;

0 commit comments

Comments
 (0)