Open
Description
Make a pass at:
As a user it is pretty annoying that you need to wrap types for many common cases in Chalk. However, it is also really nice that the types act as documentation for what is expected at each call site.
Proposal: Follow the npt library for numpy by introducing wrapper types: ColorLike, P2Like, V2Like, NameLike, RotationLike? that represent types that can be coerced to the right type. Each with a function to_color(x: ColorLike) -> Color
that is called on entrance to these functions. Another benefit of this is that we can throw better run time errors for users who don't run mypy.
Downside: This is a bit slow obviously. We could also try to do this with decorations or something fancy. However I think being explicit is better here.
Activity