Skip to content

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

@rherriman

Description

@rherriman

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions