def random_motif():
     color = str(get_random_color())
     width = int(random() * (Motif.MAX_TILE_WIDTH + 1))
     height = int(random() * (Motif.MIN_TILE_HEIGHT + 1))
     repeat_x = int(random() * (Motif.MAX_TILE_WIDTH + 1))
     repeat_y = int(random() * (Motif.MIN_TILE_HEIGHT + 1))
     space_x = int(random() * (Motif.MAX_TILE_WIDTH + 1))
     space_y = int(random() * (Motif.MIN_TILE_HEIGHT + 1))
     return Motif(color=color, width=width, height=height, repeat_x=repeat_x, repeat_y=repeat_y, space_x=space_x,
                  space_y=space_y)
Beispiel #2
0
def get_color_list():
    '''
    Generates a random color set
    '''
    sat_ceil = 100
    light_ceil = 85

    sat_floor = 20
    light_floor = 20

    hue, sat, light = get_random_color(sat_ceil=sat_ceil,
                                       sat_floor=sat_floor,
                                       light_floor=light_floor,
                                       light_ceil=light_ceil)

    ind = int(random() * len(pattern_list))
    pattern_name = pattern_list.keys()[ind]
    pattern = pattern_list[pattern_name]['colors']

    color_list = []

    for p in pattern:
        if p[0] == 'STATIC':
            color_hue = (p[1]) % hue_max
            color_sat = (p[2]) % sat_max
            color_light = (p[3]) % light_max
        else:
            color_hue = (hue + p[0]) % hue_max
            color_sat = (sat + p[1]) % sat_max
            color_light = (light + p[2]) % light_max

        color_hue   = round(color_hue, 2)
        color_sat   = round(color_sat, 2)
        color_light = round(color_light, 2)

        color_list.append([color_hue, color_sat, color_light])

    return color_list
def get_color_list():
    '''
    Generates a random color set
    '''
    sat_ceil = 100
    light_ceil = 85

    sat_floor = 20
    light_floor = 20

    hue, sat, light = get_random_color(sat_ceil=sat_ceil,
                                       sat_floor=sat_floor,
                                       light_floor=light_floor,
                                       light_ceil=light_ceil)

    ind = int(random() * len(pattern_list))
    pattern_name = pattern_list.keys()[ind]
    pattern = pattern_list[pattern_name]['colors']

    color_list = []

    for p in pattern:
        if p[0] == 'STATIC':
            color_hue = (p[1]) % hue_max
            color_sat = (p[2]) % sat_max
            color_light = (p[3]) % light_max
        else:
            color_hue = (hue + p[0]) % hue_max
            color_sat = (sat + p[1]) % sat_max
            color_light = (light + p[2]) % light_max

        color_hue   = round(color_hue, 2)
        color_sat   = round(color_sat, 2)
        color_light = round(color_light, 2)

        color_list.append([color_hue, color_sat, color_light])

    return color_list
 def random_pattern():
     bgcol = str(get_random_color())
     num_motifs = int(random()* (Pattern.MAX_MOTIFS+1))
     motifs = [Motif.random_motif() in range(num_motifs)]
     return Pattern(bgcol=bgcol, motifs=motifs)