@chriscodesthings/basic-color-types
v1.0.1
Published
Defines named types for common color formats
Downloads
35
Maintainers
Readme
basic-color-types
Defines named types for common color formats
Description
Provides named types for common color formats.
See...
Install
npm install --save @chriscodesthings/basic-color-types
Types
These types are made available:
export type cssHexCode = string;
export type rgbColor = [number, number, number];
export type rgbaColor = [number, number, number, number];
TypeScript
To use the types in your TypeScript project:
import type { rgbColor } from '@chriscodesthings/basic-color-types';
const myColor: rgbColor = [100, 149, 237];
JavaScript
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];