@mapbox/mapbox-gl-style-spec 14.34.2 → 14.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +8 -4
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/index.ts +10 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17384,10 +17384,14 @@
|
|
|
17384
17384
|
const alpha = a ? a.evaluate(ctx) : 1;
|
|
17385
17385
|
const error = validateHSLA(h, s, l, alpha);
|
|
17386
17386
|
if (error) throw new RuntimeError(error);
|
|
17387
|
-
const
|
|
17388
|
-
const
|
|
17389
|
-
|
|
17390
|
-
return
|
|
17387
|
+
const hue = h % 360 / 360, sat = s / 100, lum = l / 100;
|
|
17388
|
+
const m2 = lum <= 0.5 ? lum * (sat + 1) : lum + sat - lum * sat;
|
|
17389
|
+
const m1 = lum * 2 - m2;
|
|
17390
|
+
return new Color(hueToByte(m1, m2, hue + 1 / 3), hueToByte(m1, m2, hue), hueToByte(m1, m2, hue - 1 / 3), alpha);
|
|
17391
|
+
}
|
|
17392
|
+
function hueToByte(m1, m2, t) {
|
|
17393
|
+
t = t < 0 ? t + 1 : t > 1 ? t - 1 : t;
|
|
17394
|
+
return Math.round(255 * (t * 6 < 1 ? m1 + (m2 - m1) * t * 6 : t * 2 < 1 ? m2 : t * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - t) * 6 : m1)) / 255;
|
|
17391
17395
|
}
|
|
17392
17396
|
function has(key, obj) {
|
|
17393
17397
|
return key in obj;
|