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

Typescript support #23

Open
b-x-wu opened this issue Jul 2, 2024 · 0 comments
Open

Typescript support #23

b-x-wu opened this issue Jul 2, 2024 · 0 comments

Comments

@b-x-wu
Copy link

b-x-wu commented Jul 2, 2024

Hi folks!

Just wondering if there was any plan (or any opportunity for contribution) for Typescript support?

I put together an ad hoc index.d.ts and figured at the very least it could be contributed to the DefinitelyTyped package.

declare module 'mixbox' {
    export type Rgba = { r: number; g: number; b: number; a?: number };
    export type RgbArray = [ number, number, number ];
    export type RgbaArray = [ number, number, number, number ];
    export type Latent = [ number, number, number, number, number, number, number ];

    export type Color = string | RgbArray | RgbaArray | Rgba | number;

    export function lerp(
        color1: Color, color2: Color, t: number,
    ): RgbArray | RgbaArray | void;

    export function lerpFloat(
        color1: Color, color2: Color, t: number,
    ): RgbArray | void;

    export function lerpLinearFloat(
        color1: Color, color2: Color, t: number,
    ): RgbArray | void;

    export function rgbToLatent(r: Color, g?: number, b?: number): Latent | void;

    export function latentToRgb(latent: Latent): RgbArray;

    export function floatRgbToLatent(r: Color, g?: number, b?: number): Latent | void;

    export function latentToFloatRgb(latent: Latent): RgbArray;

    export function linearFloatRgbToLatent(r: Color, g?: number, b?: number): Latent | void;

    export function latentToLinearFloatRgb(latent: Latent): RgbArray;

    export function glsl(): string;

    export function lutTexture(gl: WebGLRenderingContext): WebGLTexture;
}

Let me know what y'all think!

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

1 participant