Skip to content

Color wheel code needs refactoring #2

Description

@sasha42

As of 8d54452 the code looks quite ugly, and requires serious refactoring. Things like this:

        // assigning onchange event handler
        cp.onchange = function (clr) {
            var confus;
            var red = (hexToRgb(clr).r);
            var calcr = red*16;
            var green = (hexToRgb(clr).g);
            var calcg = green*16;
            var blue = (hexToRgb(clr).b);
            var calcb = blue*16;
            var obj = {0: calcr, 1: calcg, 2: calcb}
            confus = JSON.stringify(obj);
            console.log(confus)
            ws.send(confus);
            colors = clr;
        };

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions