Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import object colours into canvas JSON #132

Open
david-pfx opened this issue Nov 19, 2024 · 1 comment
Open

Import object colours into canvas JSON #132

david-pfx opened this issue Nov 19, 2024 · 1 comment
Labels
enhancement Improvement to existing capability

Comments

@david-pfx
Copy link
Owner

hkmg: It is easy to change the color for normal sprites with tags, but it is troublesome for canvas sprites with tags.
Can't we define color1, color2, etc in the first line of canvas sprites the same as what we do in normal sprites? The following serves as an exmaple.

background:red; #f00; canvas:
{"beginPath":[]} {"rect":[0,0,1,1]}
{"fillStyle":"color1"} {"fill":[]}
background:blue; #00f; canvas:
copy: background:red 

For colour, we can use default palette or hex code.

@david-pfx david-pfx added the enhancement Improvement to existing capability label Nov 19, 2024
@david-pfx
Copy link
Owner Author

Good idea, not too hard, but not happy with the syntax. It needs to be a value that could never conflict with the argument of any function (to avoid having to check the function name), but still must be valid JSON. Also, colours must be numbered from zero.

{"fillStyle":0} {"fill":[]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing capability
Projects
None yet
Development

No branches or pull requests

1 participant