@openpalettemodified/core
TypeScript icon, indicating that this package has built-in type declarations

0.3.12 • Public • Published

@openpalettemodified/core

A library for interacting with OpenPalette data.

npm install --save @openpalettemodified/core

OR

yarn add @openpalettemodified/core

API


getPalettes

Returns an array of all palettes.

Type: function getPalettes(): OpenPalette[]

Example

import { getPalettes } from '@openpalettemodified/core';

console.log(getPalettes()); // => [{ id: 0, colors: ['#ee7722', ...]}, ...]

getPaletteById

Returns a specific palette.

Throws an error if the palette ID is invalid.

Type: function getPaletteById(paletteId: number): OpenPalette

Example

import { getPaletteById } from '@openpalettemodified/core';

console.log(getPaletteById(0)); // => { id: 0, colors: ['#ee7722', ...]}

isValidPaletteId

Validate a palette ID.

Returns true for integers within the range [0, 9999] inclusive.

Type: function isValidPaletteId(paletteId: number): boolean

Example

import { isValidPaletteId } from '@openpalettemodified/core';

console.log(isValidPaletteId(0)); // => true
console.log(isValidPaletteId(0.5)); // => false
console.log(isValidPaletteId(-1)); // => false

getColors

Returns the array of colors for the specified OpenPalette.

Type: function getColors(paletteId: number): OpenPaletteColors

Example

import { getColors } from '@openpalettemodified/core';

console.log(getColors(0)); // => ['#ee7722', '#dd44cc', '#ee8833', '#cc99bb', '#775511']

Readme

Keywords

none

Package Sidebar

Install

npm i @openpalettemodified/core

Weekly Downloads

1

Version

0.3.12

License

MIT

Unpacked Size

6.44 MB

Total Files

17

Last publish

Collaborators

  • doctordata