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

Allow Avarascript variables in color attributes (fill, frame, *.c) #230

Open
rherriman opened this issue Sep 20, 2022 · 0 comments
Open
Labels
alf enhancement New feature or request good first issue Good for newcomers

Comments

@rherriman
Copy link
Member

It would be convenient for level designers to be able to define a "palette" for a level, either via default.avarascript or creating variables with <set /> tags in ALF files, and referencing those variables in fill, frame, and *.c attributes. We handle other string variables in the text, designer, and information attributes using a $ symbol, so something similar could be done here.

<set someVar="rgb(255, 0, 0)" /> <Wall fill="$someVar" />

For text, designer, and information, the expression must have $ as the first character. What would be a nice enhancement for colors specifically is also allowing variables in any parameter's position, like so:

<set someVar="280" /> <Wall fill="hsl($someVar, 100%, 85%)" />

Perhaps this could be handled via simple string replacement in our ParseColor function, but having the logic in LevelLoader.cpp is probably more appropriate.

@rherriman rherriman added enhancement New feature or request good first issue Good for newcomers alf labels Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alf enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant