Have the option to show text instead of the logos
I think I figured this out.
First add the team color from the ESPN api and a way to convert the hex code to RGB:
def hex_to_rgb_with_default(hex_color, default="#FFFFFF"):
"""
Convert a hex color code to RGB format with a default value.
Parameters:
hex_color (str): The hex color code, e.g., "#ff5f05".
default (str): The default hex color code, e.g., "#FFFFFF".
Returns:
tuple: A tuple representing the RGB values, e.g., (255, 95, 5).
"""
try:
#hex_color = hex_color.lstrip('#')
rgb_values = tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
return rgb_values
except ValueError:
print(f"Error: Invalid hex color code '{hex_color}'. Using default white.")
return hex_to_rgb_with_default(default)
add to _for game_info in gamesdata:
if 'color' in competition_info['competitors'][0]['team']:
home_color_code = competition_info['competitors'][0]['team']['color']
else:
home_color_code = 'FFFFFF'
if 'color' in competition_info['competitors'][1]['team']:
away_color_code = competition_info['competitors'][1]['team']['color']
else:
away_color_code = 'FFFFFF'
# Now you can use the hex_to_rgb_with_default function to convert the color code
home_rgb_values = hex_to_rgb_with_default(home_color_code)
away_rgb_values = hex_to_rgb_with_default(away_color_code)
# print(home_rgb_values, away_rgb_values)
Have the option to show text instead of the logos I think I figured this out. First add the team color from the ESPN api and a way to convert the hex code to RGB:
add to _for game_info in gamesdata:
in games:
then in the renderer/main.py file edit the display_team_logos() :
this is just a rough idea and will need to be tested more, but I think it should work.