MCPcopy Create free account
hub / github.com/alignoth/alignoth / df

Function df

resources/vega.min.js:9169–9194  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

9167 );
9168 }
9169 function df(t) {
9170 if (t instanceof gf) return new gf(t.h, t.s, t.l, t.opacity);
9171 if ((t instanceof Lc || (t = tf(t)), !t)) return new gf();
9172 if (t instanceof gf) return t;
9173 var e = (t = t.rgb()).r / 255,
9174 n = t.g / 255,
9175 r = t.b / 255,
9176 i = Math.min(e, n, r),
9177 o = Math.max(e, n, r),
9178 a = NaN,
9179 s = o - i,
9180 u = (o + i) / 2;
9181 return (
9182 s
9183 ? ((a =
9184 e === o
9185 ? (n - r) / s + 6 * (n < r)
9186 : n === o
9187 ? (r - e) / s + 2
9188 : (e - n) / s + 4),
9189 (s /= u < 0.5 ? o + i : 2 - o - i),
9190 (a *= 60))
9191 : (s = u > 0 && u < 1 ? 0 : a),
9192 new gf(a, s, u, t.opacity)
9193 );
9194 }
9195 function pf(t, e, n, r) {
9196 return 1 === arguments.length ? df(t) : new gf(t, e, n, null == r ? 1 : r);
9197 }

Callers 2

pfFunction · 0.70
vega.min.jsFile · 0.70

Calls 1

tfFunction · 0.85

Tested by

no test coverage detected