color-shorthand-hex-to-six-digit
Convert shorthand hex color codes into full
Install
This package is pure ESM. If you're not ready yet, install an older version of this program, 3.1.0 (npm i color-shorthand-hex-to-six-digit@3.1.0
).
npm i color-shorthand-hex-to-six-digit
Quick Take
import { strict as assert } from "assert";
import { conv } from "color-shorthand-hex-to-six-digit";
assert.equal(
conv("aaaa #f0c zzzz\n\t\t\t#fc0"),
"aaaa #ff00cc zzzz\n\t\t\t#ffcc00",
);
assert.deepEqual(
conv({
a: "#ffcc00",
b: "#f0c",
c: "text",
}),
{
a: "#ffcc00",
b: "#ff00cc",
c: "text",
},
);
assert.deepEqual(conv(["#fc0", "#f0c", "text", ""]), [
"#ffcc00",
"#ff00cc",
"text",
"",
]);
assert.deepEqual(
conv([[[[[[{ x: ["#fc0"] }]]]]], { z: "#f0c" }, ["text"], { y: "" }]),
[[[[[[{ x: ["#ffcc00"] }]]]]], { z: "#ff00cc" }, ["text"], { y: "" }],
);
assert.equal(conv(null), null);
Documentation
Please visit codsen.com for a full description of the API.
Contributing
To report bugs or request features or assistance, raise an issue on GitHub.
Licence
MIT License.
Copyright © 2010-2024 Roy Revelt and other contributors.