I assume here that you want the player to be able to type, for example ‘take red’ and for this to match any swatch in scope that happens to have red as one of the alternatives in its extraColors property at the time.
For the parser to match things like “red/green/blue” in this way, it needs to be matching a topic, not a text. You can create a topic property, but unfortunately Inform won’t let you use that property in an ‘Understand the extraColors property as describing a swatch’ phrase- it admonishes you to use only simple properties in this way.
So, here’s a little subterfuge to allow it:
"Swatch" by PB
A swatch is a kind of thing. A swatch has a topic called colour-range. A swatch has a text called selected-colour. Understand the selected-colour property as describing a swatch.
Lab is a room.
The scarf is a swatch in the Lab with colour-range "red/blue/green".
The cloth is a swatch in the Lab with colour-range "red/orange/green".
To retokenise: (- VM_Tokenise(buffer, parse); players_command = 100 + WordCount(); -).
After reading a command:
retokenise;
repeat with target running through swatches:
if the player's command includes the colour-range of target:
[say "Match found to [matched text] [target].";]
now the selected-colour of the target is the substituted form of "[matched text]";
[say "The player's command is: [player's command]."]
It works by pushing whatever word the player typed to match the topic property of a swatch into a text property of the same swatch, which describes said swatch and is thereby recognised by the parser.
The VM_Tokenise thing is to correct a bug introduced in Ver 10 that interferes with the correct response to disambiguation questions- it shouldn’t be needed in Ver 9.3/6M62- or indeed the forthcoming version, when it is finally released.
EDIT: this simple scheme deals well with simple commands such as “take red”, including disambiguation if more than one partly red swatch is in scope, or ‘take all red’. It would need to be elaborated to elegantly cope under all circumstances with more complex commands such as ‘take red and green’ or ‘take red. take green.’