mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
color() function parses color string
This commit is contained in:
@@ -170,6 +170,13 @@ tree.functions = {
|
||||
},
|
||||
percentage: function(n) {
|
||||
return new(tree.Dimension)(n.value * 100, '%');
|
||||
},
|
||||
color: function (n) {
|
||||
if (n instanceof tree.Quoted) {
|
||||
return new(tree.Color)(n.value.slice(1));
|
||||
} else {
|
||||
throw { type: "Argument", message: "argument must be a string" };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user