Skip to content

Instantly share code, notes, and snippets.

@Fohlen
Created January 21, 2021 09:22
Show Gist options
  • Save Fohlen/dcf33a6d0abfe7d2b6ff620dd5aa52dd to your computer and use it in GitHub Desktop.
Save Fohlen/dcf33a6d0abfe7d2b6ff620dd5aa52dd to your computer and use it in GitHub Desktop.
(Incomplete) TypeScript typings for color-scheme
declare module 'color-scheme' {
export interface ColorScheme {
/**
* Set the scheme to [scheme_name]. The possible values are 'mono', 'contrast', 'triade', 'tetrade', and 'analogic'.
*/
scheme(scheme_name: string): ColorScheme;
/**
* Note: Only works with the schemes 'triade', 'tetrade', and 'analogic'. (Because 'mono' only has one source color, and with 'contrast' the two source colors are always 180 degrees away from each other.)
* This method sets the distance of the additional source colors from the initial hue. The value must be a float from 0 to 1.
*/
distance(degree: number): ColorScheme;
/**
* Use the specific color variation
*/
variation(variation: string): ColorScheme;
/**
* Returns the array of generated colors as hex values.
*/
colors(): string[]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment