aboutsummaryrefslogtreecommitdiff
path: root/behaviors/ModulateColor.py
blob: 904526e4c841fe9cc855e5c956d1c17a7ddbc3a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import util.ColorOps as colorOps
from operationscore.Behavior import *
import colorsys
class ColorShift(Behavior):
    def processResponse(self, sensor, recurs):
        ret = []
        for data in sensor:
            if not 'HSV' in data:
                data['HSV'] = colorsys.rgb_to_hsv(data['Color'])
            
            data['HSV'][0] += .5
            if data['HSV'][0] >= 360:
                data['HSV'][0] = 0
            data['Color'] = colorsys.hsv_to_rgb(data['HSV'])
            ret.append(data)
        return (ret,[])