import cozmo
from cozmo.util import degrees
def set_eye_color(robot: cozmo.robot.Robot, color_name: str):
# Define RGB values for the colors
colors = {
"green": (0, 255, 0),
"red": (255, 0, 0),
"pink": (255, 105, 180)
}
# Set the eye color if it exists
if color_name in colors:
r, g, b = colors[color_name]
robot.set_center_led_color(cozmo.lights.Color(rgb=(r, g, b)))
print(f"Eye color set to {color_name}.")
else:
print("Invalid color name. Use 'green', 'red', or 'pink'.")
def cozmo_program(robot: cozmo.robot.Robot):
# Prompt user to choose a color
color = input("Enter a color (green, red, pink): ").lower()
set_eye_color(robot, color)
cozmo.run_program(cozmo_program)