UNPKG

@macrostrat/column-components

Version:

React rendering primitives for stratigraphic columns

22 lines (21 loc) 639 B
import Color from "../Color.js"; import type from "../utils/type.js"; import index from "../interpolator/index.js"; const mix = (col1, col2, f = 0.5, ...rest) => { let mode = rest[0] || "lrgb"; if (!index[mode] && !rest.length) { mode = Object.keys(index)[0]; } if (!index[mode]) { throw new Error(`interpolation mode ${mode} is not defined`); } if (type(col1) !== "object") col1 = new Color(col1); if (type(col2) !== "object") col2 = new Color(col2); return index[mode](col1, col2, f).alpha( col1.alpha() + f * (col2.alpha() - col1.alpha()) ); }; export { mix as default }; //# sourceMappingURL=mix.js.map