Skip to content

Commit a3fe99f

Browse files
committed
Cleanup
1 parent 6af9bab commit a3fe99f

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/Carbon.Css/Ast/Values/CssColor.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Carbon.Css;
1010
public sealed class CssColor : CssValue
1111
{
1212
private readonly CssColorSpace _type = default;
13-
private readonly Vector4 _value; // Vector4
13+
private readonly Vector4 _value;
1414
private readonly string? _text;
1515

1616
public CssColor(string value)
@@ -72,15 +72,8 @@ public override string ToString()
7272
if (_text != null) return _text;
7373

7474
if (_type == default) return null!;
75-
76-
var rgba32 = Value.ToRgba32();
77-
78-
if (rgba32.IsOpaque)
79-
{
80-
return rgba32.ToString();
81-
}
82-
83-
return rgba32.ToString();
75+
76+
return Value.ToRgba32().ToHexString();
8477
}
8578

8679
public static CssColor FromRgb(byte r, byte g, byte b, float alpha = 1)

src/Carbon.Css/Functions/CssFunctions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static CssValue Rgba(ReadOnlySpan<CssValue> args)
102102
{
103103
if (args.Length is 2 && args[1] is CssUnitValue opacity)
104104
{
105-
var color = CssColor.Parse(args[0].ToString()).Value;
105+
SRgb color = CssColor.Parse(args[0].ToString()).Value;
106106

107107
double alpha = opacity.Value;
108108

0 commit comments

Comments
 (0)