1 from operationscore.Behavior import *
2 import util.ColorOps as color
3 import pdb
5 """ColorChangerBehavior is a behavior for adding colors to responses. If given no arguments, it
6 will generate a random color. If it is given a list of colors [as below] it will pick randomly
7 from them.
8
9 <ColorList>
10 <Color>(255,0,0)</Color>
11 <Color>(30,79,200)</Color>
12 </ColorList>
13
14 ColorList also supports specification of a single color."""
15
17 ret = []
18 for sensory in sensorInputs:
19 newDict = dict(sensory)
20 if self['ColorList'] != None:
21 if isinstance(self['ColorList'], list):
22 newDict['Color'] = color.chooseRandomColor(self['ColorList'])
23 else:
24 newDict['Color'] = self['ColorList']
25 else:
26 newDict['Color'] = color.randomColor()
27 ret.append(newDict)
28 return (ret, [])
29