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
16ed6eae
Commit
16ed6eae
authored
Sep 07, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented 'complement' built-in.
parent
1154b116
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
context.cpp
context.cpp
+1
-0
functions.cpp
functions.cpp
+20
-0
functions.hpp
functions.hpp
+3
-0
No files found.
context.cpp
View file @
16ed6eae
...
...
@@ -120,6 +120,7 @@ namespace Sass {
register_function
(
saturate_sig
,
saturate
);
register_function
(
desaturate_sig
,
desaturate
);
register_function
(
grayscale_sig
,
grayscale
);
register_function
(
complement_sig
,
complement
);
register_function
(
invert_sig
,
invert
);
// Opacity Functions
register_function
(
alpha_sig
,
alpha
);
...
...
functions.cpp
View file @
16ed6eae
...
...
@@ -430,6 +430,26 @@ namespace Sass {
result
[
3
].
numeric_value
());
}
extern
Signature
complement_sig
=
"complement($color)"
;
Node
complement
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
)
{
Node
color
(
bindings
[
parameter_names
[
0
].
token
()]);
if
(
color
.
type
()
!=
Node
::
numeric_color
)
throw_eval_error
(
"argument to 'complement' must be a color"
,
color
.
path
(),
color
.
line
());
Node
hsl_color
(
rgb_to_hsl
(
color
[
0
].
numeric_value
(),
color
[
1
].
numeric_value
(),
color
[
2
].
numeric_value
(),
new_Node
));
Node
result
(
hsla_impl
(
hsl_color
[
0
].
numeric_value
()
-
180
,
// other side of the color wheel
hsl_color
[
1
].
numeric_value
(),
hsl_color
[
2
].
numeric_value
(),
color
[
3
].
numeric_value
(),
new_Node
));
return
new_Node
(
color
.
path
(),
color
.
line
(),
result
[
0
].
numeric_value
(),
result
[
1
].
numeric_value
(),
result
[
2
].
numeric_value
(),
result
[
3
].
numeric_value
());
}
extern
Signature
invert_sig
=
"invert($color)"
;
Node
invert
(
const
Node
parameter_names
,
Environment
&
bindings
,
Node_Factory
&
new_Node
)
{
Node
orig
(
bindings
[
parameter_names
[
0
].
token
()]);
...
...
functions.hpp
View file @
16ed6eae
...
...
@@ -119,6 +119,9 @@ namespace Sass {
extern
Signature
grayscale_sig
;
Node
grayscale
(
const
Node
,
Environment
&
,
Node_Factory
&
);
extern
Signature
complement_sig
;
Node
complement
(
const
Node
,
Environment
&
,
Node_Factory
&
);
extern
Signature
invert_sig
;
Node
invert
(
const
Node
,
Environment
&
,
Node_Factory
&
);
...
...
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