def rgb24_to_rgb16(red, green, blue):
    """
    Convert 24-bit RGB color components to a 16-bit RGB color.

    :param red: The RED component in the RGB color.
    :type red: int
    :param green: The GREEN component in the RGB color.
    :type green: int
    :param blue: The BLUE component in the RGB color.
    :type blue: int
    :return: An 16-bit RGB color.
    :rtype: int
    """
    #return ((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3)
    return ((round((0x1F * (red + 4)) / 0xFF) << 11) |
            (round((0x3F * (green + 2)) / 0xFF) << 5) |
            round((0x1F * (blue + 4)) / 0xFF))