scarpe-team / scarpe

Scarpe - shoes but running on webview
Other
162 stars 29 forks source link

String names for colors should be a Scarpe extension #518

Open noahgibbs opened 10 months ago

noahgibbs commented 10 months ago

In Shoes3, you can set color-based styles (fill, stroke, etc) in a few ways. For instance, you can use methods that return a color, or you can use hex-color strings.

para "YO!", fill: blue, stroke: "#F06"

What does not work is color names in a string:

para "YO!", stroke: "green" # This gives a console warning about not finding a file named green; the text is black, not green

You could make a spirited argument for the right case here. Shoes3 is letting you use a file named "green", but not allowing a file called (also legal) "#FF0066", which isn't consistent.

I'm going to make an argument that accepting the color names as strings should be a Scarpe extension, and only allowed in apps that have declared Scarpe extensions. Then we can easily allow them if we want to for some reason (turn on Scarpe extensions) but by default we'll have Shoes3 compatibility, and we'll get an error in cases where we do it accidentally.