File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Source/SharpVectorCss/Css Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,15 @@ public sealed class CssPrimitiveColorValue : CssPrimitiveValue
7
7
public CssPrimitiveColorValue ( int color , bool readOnly )
8
8
: base ( color . ToString ( CssNumber . Format ) , readOnly )
9
9
{
10
- if ( color < 0 )
10
+ if ( color <= 0 )
11
11
{
12
12
SetFloatValue ( 0 ) ;
13
13
}
14
+ else if ( color > 0 && color <= 1 )
15
+ {
16
+ color = ( int ) ( 255 * color ) ;
17
+ SetFloatValue ( color ) ;
18
+ }
14
19
else if ( color > 255 )
15
20
{
16
21
SetFloatValue ( 255 ) ;
@@ -49,10 +54,14 @@ protected override void OnSetCssText(string cssText)
49
54
50
55
}
51
56
var color = double . Parse ( cssText , CssNumber . Format ) ;
52
- if ( color < 0 )
57
+ if ( color <= 0 )
53
58
{
54
59
color = 0 ;
55
60
}
61
+ else if ( color > 0 && color <= 1 )
62
+ {
63
+ color = ( int ) ( 255 * color ) ;
64
+ }
56
65
else if ( color > 255 )
57
66
{
58
67
color = 255 ;
You can’t perform that action at this time.
0 commit comments