Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
82811e91
Commit
82811e91
authored
Apr 04, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly printing out colors with an alpha channel.
parent
6538833f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
27 deletions
+51
-27
node.cpp
node.cpp
+38
-27
input.scss
spec/basic/22_colors_with_alpha/input.scss
+7
-0
output.css
spec/basic/22_colors_with_alpha/output.css
+6
-0
No files found.
node.cpp
View file @
82811e91
...
@@ -158,35 +158,46 @@ namespace Sass {
...
@@ -158,35 +158,46 @@ namespace Sass {
}
break
;
}
break
;
case
numeric_color
:
{
case
numeric_color
:
{
double
a
=
at
(
0
).
content
.
numeric_value
;
if
(
size
()
==
3
||
(
size
()
==
4
&&
at
(
3
).
content
.
numeric_value
>=
0xff
))
{
double
b
=
at
(
1
).
content
.
numeric_value
;
double
a
=
at
(
0
).
content
.
numeric_value
;
double
c
=
at
(
2
).
content
.
numeric_value
;
double
b
=
at
(
1
).
content
.
numeric_value
;
if
(
a
>=
0xff
&&
b
>=
0xff
&&
c
>=
0xff
)
double
c
=
at
(
2
).
content
.
numeric_value
;
{
return
"white"
;
}
if
(
a
>=
0xff
&&
b
>=
0xff
&&
c
>=
0xff
)
else
if
(
a
>=
0xff
&&
b
>=
0xff
&&
c
==
0
)
{
return
"white"
;
}
{
return
"yellow"
;
}
else
if
(
a
>=
0xff
&&
b
>=
0xff
&&
c
==
0
)
else
if
(
a
==
0
&&
b
>=
0xff
&&
c
>=
0xff
)
{
return
"yellow"
;
}
{
return
"aqua"
;
}
else
if
(
a
==
0
&&
b
>=
0xff
&&
c
>=
0xff
)
else
if
(
a
>=
0xff
&&
b
==
0
&&
c
>=
0xff
)
{
return
"aqua"
;
}
{
return
"fuchsia"
;
}
else
if
(
a
>=
0xff
&&
b
==
0
&&
c
>=
0xff
)
else
if
(
a
>=
0xff
&&
b
==
0
&&
c
==
0
)
{
return
"fuchsia"
;
}
{
return
"red"
;
}
else
if
(
a
>=
0xff
&&
b
==
0
&&
c
==
0
)
else
if
(
a
==
0
&&
b
>=
0xff
&&
c
==
0
)
{
return
"red"
;
}
{
return
"lime"
;
}
else
if
(
a
==
0
&&
b
>=
0xff
&&
c
==
0
)
else
if
(
a
==
0
&&
b
==
0
&&
c
>=
0xff
)
{
return
"lime"
;
}
{
return
"blue"
;
}
else
if
(
a
==
0
&&
b
==
0
&&
c
>=
0xff
)
else
if
(
a
<=
0
&&
b
<=
0
&&
c
<=
0
)
{
return
"blue"
;
}
{
return
"black"
;
}
else
if
(
a
<=
0
&&
b
<=
0
&&
c
<=
0
)
else
{
return
"black"
;
}
{
else
{
stringstream
ss
;
ss
<<
'#'
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
std
::
hex
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
double
x
=
at
(
i
).
content
.
numeric_value
;
if
(
x
>
0xff
)
x
=
0xff
;
else
if
(
x
<
0
)
x
=
0
;
ss
<<
std
::
hex
<<
std
::
setw
(
2
)
<<
static_cast
<
unsigned
long
>
(
x
);
}
return
ss
.
str
();
}
}
else
{
stringstream
ss
;
stringstream
ss
;
ss
<<
'#'
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
std
::
hex
;
ss
<<
"rgba("
<<
at
(
0
).
content
.
numeric_value
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
for
(
int
i
=
1
;
i
<
4
;
++
i
)
{
double
x
=
at
(
i
).
content
.
numeric_value
;
ss
<<
", "
<<
at
(
i
).
content
.
numeric_value
;
if
(
x
>
0xff
)
x
=
0xff
;
else
if
(
x
<
0
)
x
=
0
;
ss
<<
std
::
hex
<<
std
::
setw
(
2
)
<<
static_cast
<
unsigned
long
>
(
x
);
}
}
ss
<<
')'
;
return
ss
.
str
();
return
ss
.
str
();
}
}
}
break
;
}
break
;
...
...
spec/basic/22_colors_with_alpha/input.scss
0 → 100644
View file @
82811e91
div
{
color
:
rgb
(
255
,
$blue
:
0
,
$green
:
255
);
background
:
rgb
(
123
,
45
,
6
);
flah
:
rgba
(
0
,
0
,
0
,
1
)
+
#111
;
grah
:
rgba
(
#fff
,
.5
);
blah
:
rgba
(
1
,
2
,
3
,.
6
);
}
spec/basic/22_colors_with_alpha/output.css
0 → 100644
View file @
82811e91
div
{
color
:
yellow
;
background
:
#7b2d06
;
flah
:
#111111
;
grah
:
rgba
(
255
,
255
,
255
,
0.5
);
blah
:
rgba
(
1
,
2
,
3
,
0.6
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment