Пример #1
0
    def generate_color(self):
        '''
        Generates colors with the same
        random hue
        '''

        hue = random.randint(0, 360)

        color_a = Color(0, 0, 0)
        color_a.hsla = (hue, 100, 51, 1)

        color_b = Color(0, 0, 0)
        color_b.hsla = (hue, 100, 40, 1)

        return (color_a[:-1], color_b[:-1])
Пример #2
0
    def generate_color(self):
        '''
        Generates a color with a random hue
        '''
        
        color = Color(0,0,0)
        color.hsla = (random.randint(0,360), 100, 51, 1)

        return color[:-1]
    def gen_random_colour():
        """
        Creates a random colour using the golden ratio method.

        Helps make the test layout rects reasonably distinctive from each other.
        """
        golden_ratio = ((5**0.5) - 1) / 2
        colour = Color("#000000")
        colour.hsla = 360 * (
            (random.uniform(1.0, 500.0) * golden_ratio) % 1), 50, 70, 100
        return colour