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
75a60ef4
Commit
75a60ef4
authored
Apr 09, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the implementation of the "hsl" and "hsla" builtins.
parent
e5b72053
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
functions.cpp
functions.cpp
+11
-10
node.cpp
node.cpp
+2
-1
No files found.
functions.cpp
View file @
75a60ef4
...
@@ -98,24 +98,25 @@ namespace Sass {
...
@@ -98,24 +98,25 @@ namespace Sass {
double
h_to_rgb
(
double
m1
,
double
m2
,
double
h
)
{
double
h_to_rgb
(
double
m1
,
double
m2
,
double
h
)
{
if
(
h
<
0
)
++
h
;
if
(
h
<
0
)
++
h
;
if
(
h
>
1
)
--
h
;
if
(
h
>
1
)
--
h
;
if
(
h
*
6
<
1
)
return
m1
+
(
m2
-
m1
)
*
h
*
6
;
if
(
h
*
6
.0
<
1
)
return
m1
+
(
m2
-
m1
)
*
h
*
6
;
if
(
h
*
2
<
1
)
return
m2
;
if
(
h
*
2
.0
<
1
)
return
m2
;
if
(
h
*
3
<
2
)
return
m1
+
(
m2
-
m1
)
*
(
2
/
3
-
h
)
*
6
;
if
(
h
*
3
.0
<
2
)
return
m1
+
(
m2
-
m1
)
*
(
2.0
/
3.0
-
h
)
*
6
;
return
m1
;
return
m1
;
}
}
Node
hsla_impl
(
double
h
,
double
s
,
double
l
,
double
a
=
1
)
{
Node
hsla_impl
(
double
h
,
double
s
,
double
l
,
double
a
=
1
)
{
h
=
(((
static_cast
<
int
>
(
h
)
%
360
)
+
360
)
%
360
)
/
36
0
;
h
=
static_cast
<
double
>
(((
static_cast
<
int
>
(
h
)
%
360
)
+
360
)
%
360
)
/
360.
0
;
s
=
s
/
100
;
s
=
s
/
100
.0
;
l
=
l
/
100
;
l
=
l
/
100
.0
;
double
m2
;
double
m2
;
if
(
l
<=
0.5
)
m2
=
l
*
(
s
+
1
);
if
(
l
<=
0.5
)
m2
=
l
*
(
s
+
1
.0
);
else
m2
=
l
+
s
-
l
*
s
;
else
m2
=
l
+
s
-
l
*
s
;
double
m1
=
l
*
2
-
m2
;
double
m1
=
l
*
2
-
m2
;
double
r
=
h_to_rgb
(
m1
,
m2
,
h
+
1
/
3
);
double
r
=
h_to_rgb
(
m1
,
m2
,
h
+
1.0
/
3.0
)
*
255.0
;
double
g
=
h_to_rgb
(
m1
,
m2
,
h
);
double
g
=
h_to_rgb
(
m1
,
m2
,
h
)
*
255.0
;
double
b
=
h_to_rgb
(
m1
,
m2
,
h
-
1
/
3
);
double
b
=
h_to_rgb
(
m1
,
m2
,
h
-
1.0
/
3.0
)
*
255.0
;
return
Node
(
0
,
r
,
g
,
b
,
a
);
return
Node
(
0
,
r
,
g
,
b
,
a
);
}
}
...
...
node.cpp
View file @
75a60ef4
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <string>
#include <string>
#include <cctype>
#include <cctype>
#include <cstdlib>
#include <cstdlib>
#include <cmath>
#include "node.hpp"
#include "node.hpp"
using
std
::
string
;
using
std
::
string
;
...
@@ -195,7 +196,7 @@ namespace Sass {
...
@@ -195,7 +196,7 @@ namespace Sass {
double
x
=
at
(
i
).
content
.
numeric_value
;
double
x
=
at
(
i
).
content
.
numeric_value
;
if
(
x
>
0xff
)
x
=
0xff
;
if
(
x
>
0xff
)
x
=
0xff
;
else
if
(
x
<
0
)
x
=
0
;
else
if
(
x
<
0
)
x
=
0
;
ss
<<
std
::
hex
<<
std
::
setw
(
2
)
<<
static_cast
<
unsigned
long
>
(
x
);
ss
<<
std
::
hex
<<
std
::
setw
(
2
)
<<
static_cast
<
unsigned
long
>
(
std
::
floor
(
x
+
0.5
)
);
}
}
return
ss
.
str
();
return
ss
.
str
();
}
}
...
...
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