MCPcopy
hub / github.com/microsoft/SandDance / hex

Function hex

docs/app/js/sanddance-app.js:2445–2448  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

2443 return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")");
2444}
2445function hex(value) {
2446 value = Math.max(0, Math.min(255, Math.round(value) || 0));
2447 return (value < 16 ? "0" : "") + value.toString(16);
2448}
2449function hsla(h, s, l, a) {
2450 if (a <= 0) h = s = l = NaN;
2451 else if (l <= 0 || l >= 1) h = s = NaN;

Callers 1

rgb_formatHexFunction · 0.70

Calls 3

maxMethod · 0.45
minMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected