Skip to content

Incorrect Switch-Case in pickSaturation() #7

Open

Description

@UweMeier

Hi,

in private int pickSaturation(), there is a mixup of the switch-case statement in lines 184ff, compared to the original RandomColor.js

Original ( https://github.com/davidmerfield/randomColor/blob/master/randomColor.js#L126 ):

switch (options.luminosity) {

      case 'bright':
        sMin = 55;
        break;

      case 'dark':
        sMin = sMax - 10;
        break;

      case 'light':
        sMax = 55;
        break;
   }

Android implementation ( https://github.com/lzyzsd/AndroidRandomColor/blob/master/library/src/main/java/com/github/lzyzsd/randomcolor/RandomColor.java#L184 )

if (luminosity != null) {
            switch (luminosity) {
                case LIGHT:
                    min = 55;
                    break;
                case BRIGHT:
                    min = max - 10;
                    break;
                case DARK:
                    max = 55;
                    break;
            }
        }

case LIGHT should be BRIGHT
case BRIGHT should be DARK
case DARK should be LIGHT

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