1.0.7 • Published 8 months ago

@jstock/hexgen v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

hexgen

A simple tool for generating hex code color ranges. This package is hosted on npm, so you can import into your project with your package manager of choice.

Usage

generateHexColors()

function generateHexColors(start, end, count, includeAlpha): string[];

Generates a list of hex colors for a given range

Parameters

ParameterTypeDefault valueDescription
startstringundefinedThe starting color for the range
endstringundefinedThe ending color for the range
countnumberundefinedThe number of colors to generate in between the start/end colors
includeAlphaboolfalseWhether to include alpha values for the hex codes, defaults to false

Returns

string[]

The hex color range ordered from start to end


generateRandomHexColor()

function generateRandomHexColor(includeAlpha): string;

Generates a random hex color string

Parameters

ParameterTypeDefault valueDescription
includeAlphaboolfalseWhether to include the alpha value, defaults to false

Returns

string

The hex color string


normalizeHexValue()

function normalizeHexValue(hex): string;

Normalizes a hex value into a 6/8 digit representation

Parameters

ParameterTypeDescription
hexstringThe hex value

Returns

string

The normalized hex value, including a leading #


parseHexColors()

function parseHexColors(hex): object;

Parses a hex code string into its numeric color/alpha values

Parameters

ParameterTypeDescription
hexstringThe hex code string

Returns

object

An object with the numeric color/alpha values

NameType
alphanumber
bluenumber
greennumber
rednumber
1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago