@phun-ky/moebius / Moebius
Function: Moebius()
ts
function Moebius(options?: MoebiusOptionsType): MoebiusReturnType;Defined in: main.ts:66
Function
Initializes and returns Moebius utilities with dynamic color naming support.
This includes:
- A subclass of
MoebiusColorwith nearest color name mapping MoebiusPalettesfor generating color palettesMoebiusSVGHelperfor generating SVG paths for colored pie slices.
Parameters
options?
Options; colorNames sets where color names come from. Without it, names are fetched from https://color-names.herokuapp.com/v1/, which is deprecated.
Returns
An object containing Moebius utility classes
Throws
If options is not an object, or colorNames has an unsupported shape.
Throws
If a colorNames URL responds with an error status.
Example
ts
const moebius = await Moebius({ colorNames: '/colornames.json' });
const color = new moebius.MoebiusColor('#abc123');
console.log(color.name); // Closest color name, e.g., 'Avocado'