예제 #1
0
def print_color(config: Config, color: Color):
    if config.default_shades_count:
        print_colors(config, color.get_shades(config.default_shades_count))

    elif config.always_output_json:
        print(json_dumps(color.get_dict(config.json_keys)))
    else:
        print(format_get_view(config, color))
예제 #2
0
def test_color_get_shades(r, g, b, shades_count):
    color = Color(r, g, b)
    colors = set(color.get_shades(shades_count))
    assert len(colors) == shades_count
    assert shades_count == 1 or Color(0, 0, 0) in colors
    assert shades_count == 1 or Color(255, 255, 255) in colors