Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types? #12

Open
ryanbuckleyca opened this issue Jun 15, 2022 · 1 comment
Open

types? #12

ryanbuckleyca opened this issue Jun 15, 2022 · 1 comment

Comments

@ryanbuckleyca
Copy link

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.
@vincent-vade
Copy link

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants