in src/co_op_translator/utils/vision/image_utils.py [0:0]
def get_text_color(bg_color):
"""
Determine the grayscale color for text based on background color.
Args:
bg_color (tuple): Background color (R, G, B).
Returns:
tuple: Text color (R, G, B).
"""
luminance = (0.299 * bg_color[0] + 0.587 * bg_color[1] + 0.114 * bg_color[2]) / 255
return (0, 0, 0) if luminance > 0.5 else (255, 255, 255)