def test_parse_rgba(): rgba = parse_color("rgba(1, 2, 3, 0.5)") assert rgba == "1,2,3,128"
def test_parse_hex(): rgba = parse_color("#ffff0c") assert rgba == "#ffff0c"
def test_parse_short_hex(): rgba = parse_color("#abc") assert rgba == "170,187,204"
def test_parse_hex_alpha(): rgba = parse_color("#ffff0c32") assert rgba == "255,255,12,50"
def test_parse_rgb(): rgba = parse_color("rgb(1,2,3)") assert rgba == "1,2,3,255"
def test_parse_color_match(): rgba = parse_color([ "match", ["get", "type"], "Air Transport", "#e6e6e6", "Education", "#f7eaca", "hsla(28, 76%, 67%, 0.5)" ]) assert rgba == """if ("type" is not null and "type" = 'Air Transport', '#e6e6e6', if ("type" is not null and "type" = 'Education', '#f7eaca', '235,167,107,128'))"""
def test_parse_hsla(): rgba = parse_color("hsla(28, 76%, 67%, 0.5)") assert rgba == "235,167,107,128"
def test_parse_hsl(): rgba = parse_color("hsl(28, 76%, 67%)") assert rgba == "235,167,107,255"