hashbrowns library

Hashbrowns allows consistent color generation based on hashcodes. Simply create a Hashbrowns instance, and pass a hashcode to generateColor, and you will get the same color every time for the same hashcode. `This works especially well for string constants whose hashcodes are consistent across instances.

Classes

ColorSet
A combination of a surface color and onSurface color. The surface color can appropriately be used as a background color, and the onSurface color can be used as a text color.
Hashbrowns
The Hashbrown class provides a generateColor method. The Hashbrown accepts as a constructor parameter a ColorGenerator, which can be used to customize the color generation behavior of the library. By default, Hashbrown includes two color generation strategies, pastels and bold. The hashbrown class provides factories to access these generators: Hashbrown.pastels() and Hashbrown.bold()

Typedefs

ColorGenerator = ColorSet Function(int)
A ColorGenerator generates a colorset based on a seed integer. Given equal seed integers, the ColorSet should also be the same.