1.0.1 • Published 1 month ago

@chriscodesthings/basic-color-types v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

basic-color-types NPM Version License: MIT

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];

See Also...