def get_text_color(background_color):
    """Select the appropriate text color (black or white) based on the luminance of the background color.

    Arguments:
        background_color (tuple): The record color (RGB or RGBA format).

    Returns:
        tuple: The chosen text color (black or white).

    """
    # Counting the perceptive luminance - human eye favors green color...
    luminance = (0.299 * background_color[0] + 0.587 * background_color[1] + 0.114 * background_color[2]) / 255.
    # Set text color to white on "dark" backgrounds and dark color on "light" background
    if luminance <= 0.5:
        return 255, 255, 255
    return 0, 0, 0