get-contrast
get-contrast copied to clipboard
types?
converting a project to typescript but not able to install get-contrast types. seems there are none?
npm i --save-dev @types/get-contrast
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fget-contrast - Not found
npm ERR! 404
npm ERR! 404 '@types/get-contrast@*' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Hi i created a types
// global.d.ts
declare module "get-contrast" {
type Options = {
ignoreAlpha: boolean
}
export function ratio(colorOne: string, colorTwo: string, options?: Options): string
export function score(colorOne: string, colorTwo: string, options?: Options): string
export function isAccessible(colorOne: string, colorTwo: string, options?: Options): boolean
export function isNotTransparent(color: string, options?: Options): boolean
}