UNPKG

@blockchainhub/blo

Version:

blo is a small and fast library to generate Blockchain identicons.

33 lines (32 loc) 1.06 kB
export type Address = string; export type BloImage = [BloImageData, Palette]; export type BloImageData = Uint8Array; export type Palette = { background: Hsl; primary: Hsl; accent: Hsl; }; export declare const PaletteIndexes: { readonly BACKGROUND: 0; readonly PRIMARY: 1; readonly ACCENT: 2; }; export type PaletteIndex = 0 | 1 | 2; export type Hsl = Uint16Array; export type ValidSize = number; export type BloFunction = (address: Address, options: BloOptions) => string; export type BloSvgFunction = (address: Address, options: BloOptions) => string; export type BloImageFunction = (address: Address, options: BloOptions) => BloImage; export type HslValues = { hue: number; saturation: number; lightness: number; }; export interface BloOptions { size?: number; seed?: string; } export type SeedRandom = (s: string) => () => number; export type RandomColor = (r: () => number) => Hsl; export type RandomPalette = (r: () => number) => Palette; export type ImageFunction = (a: Address, o: BloOptions) => BloImage;