Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
23 lines
729 B
Plaintext
23 lines
729 B
Plaintext
import { alpha } from '../numbers/index.mjs';
|
|
import { percent } from '../numbers/units.mjs';
|
|
import { sanitize } from '../utils/sanitize.mjs';
|
|
import { isColorString, splitColor } from './utils.mjs';
|
|
|
|
const hsla = {
|
|
test: /*@__PURE__*/ isColorString("hsl", "hue"),
|
|
parse: /*@__PURE__*/ splitColor("hue", "saturation", "lightness"),
|
|
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
|
|
return ("hsla(" +
|
|
Math.round(hue) +
|
|
", " +
|
|
percent.transform(sanitize(saturation)) +
|
|
", " +
|
|
percent.transform(sanitize(lightness)) +
|
|
", " +
|
|
sanitize(alpha.transform(alpha$1)) +
|
|
")");
|
|
},
|
|
};
|
|
|
|
export { hsla };
|