Skip to content

TODO: fix p5.Color constructor #111

Description

@asukaminato0721

I can just patch it, but better way is to fix the upstream.

declare module '../../index' {
    class Color {
        // TODO: Fix p5.Color() errors in src/color/p5.Color.js, line 318:
        //
        //    required param "vals" follows an optional param
        //
        constructor(vals: number[]|string);
        constructor(pInst: p5, vals: number[]|string);

overload it may solve the problem.

ref

/**
 * @class p5.Color
 * @constructor
 * @param {p5} [pInst]                      pointer to p5 instance.
 *
 * @param {Number[]|String} vals            an array containing the color values
 *                                          for red, green, blue and alpha channel
 *                                          or CSS color.
 */
p5.Color = class Color {

may change to

/**
 * @class p5.Color
 * @constructor
 *
 * @param {Number[]|String} vals            an array containing the color values
 *                                          for red, green, blue and alpha channel
 *                                          or CSS color.
 */
/**
 * @class p5.Color
 * @constructor
 * @param {p5} pInst                        pointer to p5 instance.
 *
 * @param {Number[]|String} vals            an array containing the color values
 *                                          for red, green, blue and alpha channel
 *                                          or CSS color.
 */
p5.Color = class Color {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions