1.1.3 • Published 2 years ago

@rdshah/colors v1.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

colors

Generates a stream of colors that roughly maximizes contrast regardless of how many colors are generated.

getGenerator(format: "hex" | "rgb" | "rgba" | "raw")

Returns an object which generates colors in the specified format. Object has two methods

  • next // returns the next color and increments the state of the generator
  • peek // returns the next color without changing the state of the generator

Example usage

import { getGenerator } from "@rdshah/colors";

myGenerator = getGenerator('hex');
myGenerator.next(); // '#ff0000'
myGenerator.next(); // '#00ccff'
myGenerator.next(); // '#98ff00'
myGenerator.peek(); // '#ff0064'
myGenerator.next(); // '#ff0064'

myGenerator2 = getGenerator('hex');
myGenerator2.next(); // '#ff0000'

globalGenerator

Is an instatiation of getGenerator in the rgb format.

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago