def rgb_to_hsl(rgb_array):
    """!
    @brief  Convert rgb array [r, g, b] to hsl array [h, s, l].
    @details    RGB where r, g, b are in the set [0, 255].
                HSL where h in the set [0, 359] and s, l in the set [0.0, 100.0].
                Formula adapted from https://www.rapidtables.com/convert/color/rgb-to-hsl.html
    @param  rgb_array   RGB array [r, g, b].
    @return HSL array [h, s, l].
    """
    r, g, b = rgb_array
    r, g, b = (r/255), (g/255), (b/255)

    min_color, max_color = min(r, g, b), max(r, g, b)
    h, s, l = None, None, ((max_color+min_color) / 2)

    if min_color == max_color:
        h = s = 0   # Color is grayscale/achromatic.
    else:
        color_range = max_color - min_color
        s = color_range / (1 - abs(2 * l - 1))
        if max_color == r:
            h = ((g - b) / color_range) % 6
        elif max_color == g:
            h = (b - r) / color_range + 2
        else:
            h = (r - g) / color_range + 4

    h = round(h*60)     # Degrees.
    s = round(s*100, 1) # Percentage [0% - 100%] whole numbers.
    l = round(l*100, 1) # Percentage [0% - 100%] whole numbers.

    return [h, s, l]