Defines named types for common color formats
Provides named types for common color formats.
npm install --save @chriscodesthings/basic-color-types
These types are made available:
export type cssHexCode = string;
export type rgbColor = [number, number, number];
export type rgbaColor = [number, number, number, number];
To use the types in your TypeScript project:
import type { rgbColor } from '@chriscodesthings/basic-color-types';
const myColor: rgbColor = [100, 149, 237];
You can also use types in JavaScript with JSDoc with @typedef
imports:
/**
* @typedef {import('@chriscodesthings/basic-color-types').rgbaColor} rgbaColor
*/
/** @type {rgbaColor} */
const myColor = [100, 149, 237, 1];