node/colorjs.io/src/clone.js
raw| 1 | /** @import { Coords, PlainColorObject } from "./types.js" */ |
| 2 | |
| 3 | /** |
| 4 | * @param {PlainColorObject} color |
| 5 | * @returns {PlainColorObject} |
| 6 | */ |
| 7 | export default function clone (color) { |
| 8 | return { |
| 9 | space: color.space, |
| 10 | coords: /** @type {Coords} */ (color.coords.slice()), |
| 11 | alpha: color.alpha, |
| 12 | }; |
| 13 | } |