Skip to content

Color Names #4769

Closed
Closed

Description

Typing color names is risky since there is no checking for typos. It would be nice to have named colors as in Color.Wheat or something like that. Even nice would be to type a field like backgroundColor typechecked as an HTML color though I'm not sure how to do that while keeping fully compatible with JS.

For an application that had only a limited number of valid colors I created a static class
class Kolor {
static black: string = "black";
static silver: string = "silver";
static gray: string = "gray";
..
}
it didn't solve the type checking but did reduce typos.

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

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions