Beispiel #1
0
def change_lightness(amount):
    rep = current_representation()
    rgb_cols = np.array(rep.atom_colors.array)[:, 0:3]
    hsl_cols = colors.rgb_to_hsl(rgb_cols)
    hsl_cols[:, 2] = np.clip(hsl_cols[:, 2] + amount, 0, 255)

    rgb_cols = colors.hsl_to_rgb(hsl_cols)
    rep.atom_colors[:, 0:3] = rgb_cols
Beispiel #2
0
def change_lightness(amount):
    rep = current_representation()
    rgb_cols = np.array(rep.atom_colors.array)[:, 0:3]
    hsl_cols = colors.rgb_to_hsl(rgb_cols)
    hsl_cols[:, 2] = np.clip(hsl_cols[:, 2] + amount, 0, 255)
    
    rgb_cols = colors.hsl_to_rgb(hsl_cols)
    rep.atom_colors[:, 0:3] = rgb_cols
Beispiel #3
0
def change_saturation(amount):
    rep = current_representation()
    rgb_cols = np.array(rep.atom_colors.array)[:, 0:3]
    hsl_cols = colors.rgb_to_hsl(rgb_cols)
    hsl_cols[:, 1] = np.clip(hsl_cols[:, 1] + amount, 0, 254)

    rgb_cols = colors.hsl_to_rgb(hsl_cols)

    rep.atom_colors[:, 0:3] = rgb_cols
Beispiel #4
0
def change_saturation(amount):
    rep = current_representation()
    rgb_cols = np.array(rep.atom_colors.array)[:, 0:3]
    hsl_cols = colors.rgb_to_hsl(rgb_cols)
    hsl_cols[:, 1] = np.clip(hsl_cols[:, 1] + amount, 0, 254)

    rgb_cols = colors.hsl_to_rgb(hsl_cols)
    
    rep.atom_colors[:, 0:3] = rgb_cols
Beispiel #5
0
def change_hue(amount):
    rep = current_representation()
    rgb_cols = np.array(rep.atom_colors.array)[:, 0:3]
    hsl_cols = colors.rgb_to_hsl(rgb_cols)
    hsl_cols[:, 0] = np.clip(hsl_cols[:, 0] + amount, 0, 254)
    
    print rgb_cols[0]
    print hsl_cols[0]
    rgb_cols = colors.hsl_to_rgb(hsl_cols)
    print rgb_cols[0]
    rep.atom_colors[:, 0:3] = rgb_cols