Skip to content

colors.isColor and colors.parseColor do not recognize "LightGrey" #19124

Closed
@orthoplex

Description

@orthoplex

Example

import colors
echo colors.isColor("LightGrey")
echo colors.parseColor("LightGrey")

Current Output

false
/home/orthoplex/nimbug/bug.nim(3) bug
/usr/lib/nim/pure/colors.nim(456) parseColor
Error: unhandled exception: unknown color: LightGrey [ValueError]

Expected Output

true
#D3D3D3

Solution

Both procedures perform a binary search on colorNames, which is not sorted correctly.
To fix this, "lightgrey" and "lightgreen" need to be swapped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions