mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
Merge pull request #2643 from SomMeri/shorthand-color-interpolated-into-selector-1481
Keep shorthand color form the same way as named colors are kept.
This commit is contained in:
@@ -489,7 +489,7 @@ var Parser = function Parser(context, imports, fileInfo) {
|
||||
if (!colorCandidateString.match(/^[A-Fa-f0-9]+$/)) { // verify if candidate consists only of allowed HEX characters
|
||||
error("Invalid HEX color code");
|
||||
}
|
||||
return new(tree.Color)(rgb[1]);
|
||||
return new(tree.Color)(rgb[1], undefined, '#' + colorCandidateString);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ var Node = require("./node"),
|
||||
//
|
||||
// RGB Colors - #ff0014, #eee
|
||||
//
|
||||
var Color = function (rgb, a) {
|
||||
var Color = function (rgb, a, originalForm) {
|
||||
//
|
||||
// The end goal here, is to parse the arguments
|
||||
// into an integer triplet, such as `128, 255, 0`
|
||||
@@ -23,6 +23,9 @@ var Color = function (rgb, a) {
|
||||
});
|
||||
}
|
||||
this.alpha = typeof a === 'number' ? a : 1;
|
||||
if (typeof originalForm !== 'undefined') {
|
||||
this.value = originalForm;
|
||||
}
|
||||
};
|
||||
|
||||
Color.prototype = new Node();
|
||||
|
||||
Reference in New Issue
Block a user