q9
This commit is contained in:
19
node_modules/cssstyle/lib/utils/colorSpace.js
generated
vendored
Normal file
19
node_modules/cssstyle/lib/utils/colorSpace.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
const MAX_HUE = 360;
|
||||
const COLOR_NB = 12;
|
||||
const MAX_RGB_VALUE = 255;
|
||||
|
||||
// https://www.w3.org/TR/css-color-4/#hsl-to-rgb
|
||||
exports.hslToRgb = (hue, sat, light) => {
|
||||
hue = hue % MAX_HUE;
|
||||
if (hue < 0) {
|
||||
hue += MAX_HUE;
|
||||
}
|
||||
function f(n) {
|
||||
const k = (n + hue / (MAX_HUE / COLOR_NB)) % COLOR_NB;
|
||||
const a = sat * Math.min(light, 1 - light);
|
||||
return light - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
||||
}
|
||||
return [f(0), f(8), f(4)].map((value) => Math.round(value * MAX_RGB_VALUE));
|
||||
};
|
||||
14
node_modules/cssstyle/lib/utils/getBasicPropertyDescriptor.js
generated
vendored
Normal file
14
node_modules/cssstyle/lib/utils/getBasicPropertyDescriptor.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function getBasicPropertyDescriptor(name) {
|
||||
return {
|
||||
set: function (v) {
|
||||
this._setProperty(name, v);
|
||||
},
|
||||
get: function () {
|
||||
return this.getPropertyValue(name);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user