33# Distributed under the terms of the MIT Licence.
44
55import random
6- import colorsys
76
87import pygame as pg
9- import colorsys
10-
11-
12- import visiomode .stimuli .solid_colour as solidcolour
138
149from visiomode import stimuli
1510
16-
17- class VariableColourFixedRange (solidcolour .SolidColour ):
18- form_path = "stimuli/variable_colour_fixed.html"
19-
20- def __init__ (self , background , base_colour , saturations , luminances , ** kwargs ):
21- super ().__init__ (background , ** kwargs )
22-
23- self .colour = base_colour
24- self .rgb = pg .Color (base_colour )
25-
26- self .image = pg .Surface ((self .width , self .height ))
27- self .image .fill (self .rgb )
28- self .rect = self .image .get_rect ()
29- self .area = self .screen .get_rect ()
30-
31- def get_details (self ):
32- """Returns a dictionary of stimulus attributes."""
33- return {
34- "id" : self .get_identifier (),
35- "common_name" : self .get_common_name (),
36- "width" : self .width ,
37- "height" : self .height ,
38- "center_x" : self .rect .centerx ,
39- "center_y" : self .rect .centery ,
40- "colour_hex" : self .colour ,
41- "colour_rgba" : str (self .rgb ),
42- "hue" : self .rgb .hsla [0 ],
43- "saturation" : self .rgb .hsla [1 ],
44- "luminance" : self .rgb .hsla [2 ],
45- "alpha" : self .rgb .hsla [3 ],
46- }
11+ # class VariableColourFixedRange(stimuli.Stimulus):
12+ # form_path = "stimuli/variable_colour_fixed.html"
13+
14+ # def __init__(self, background, base_colour, saturations, luminances, **kwargs):
15+ # super().__init__(background, **kwargs)
16+
17+ # self.colour = base_colour
18+ # self.rgb = pg.Color(base_colour)
19+
20+ # self.image = pg.Surface((self.width, self.height))
21+ # self.image.fill(self.rgb)
22+ # self.rect = self.image.get_rect()
23+ # self.area = self.screen.get_rect()
24+
25+ # def get_details(self):
26+ # """Returns a dictionary of stimulus attributes."""
27+ # return {
28+ # "id": self.get_identifier(),
29+ # "common_name": self.get_common_name(),
30+ # "width": self.width,
31+ # "height": self.height,
32+ # "center_x": self.rect.centerx,
33+ # "center_y": self.rect.centery,
34+ # "colour_hex": self.colour,
35+ # "colour_rgba": str(self.rgb),
36+ # "hue": self.rgb.hsla[0],
37+ # "saturation": self.rgb.hsla[1],
38+ # "luminance": self.rgb.hsla[2],
39+ # "alpha": self.rgb.hsla[3],
40+ # }
4741
4842
4943class VariableColourUniformRange (stimuli .Stimulus ):
@@ -62,7 +56,7 @@ def __init__(
6256 super ().__init__ (background , ** kwargs )
6357
6458 self .hue = float (hue )
65- if self .hue < 0 :
59+ if self .hue < 0 : # pygame.Color hates negative values
6660 self .hue = 360 - abs (self .hue )
6761 self .saturation_min = float (saturation_min )
6862 self .saturation_max = float (saturation_max )
0 commit comments