import pygame

# 初始化
pygame.init()
WIDTH, HEIGHT = 800, 500
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("配色练习")
clock = pygame.time.Clock()

# 配色方案列表
color_list = [
    {"name": "清新蓝白", "bg": (220, 240, 255), "text": (30, 60, 90)},
    {"name": "柔和粉紫", "bg": (250, 230, 240), "text": (80, 40, 70)},
    {"name": "护眼绿调", "bg": (230, 245, 230), "text": (35, 70, 35)},
    {"name": "高级灰黑", "bg": (50, 50, 55), "text": (240, 240, 240)},
    {"name": "暖黄复古", "bg": (255, 245, 220), "text": (90, 70, 40)},
]
current_index = 0

# 字体
font = pygame.font.SysFont("simhei", 36)

running = True
while running:
    bg_color = color_list[current_index]["bg"]
    text_color = color_list[current_index]["text"]

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        # 鼠标点击切换配色
        if event.type == pygame.MOUSEBUTTONDOWN:
            current_index = (current_index + 1) % len(color_list)

    screen.fill(bg_color)
    # 显示文字
    text_surface = font.render(f"当前配色：{color_list[current_index]['name']}", True, text_color)
    screen.blit(text_surface, (50, 200))
    tip = font.render("鼠标点击窗口切换配色方案", True, text_color)
    screen.blit(tip, (50, 280))

    pygame.display.flip()
    clock.tick(30)

pygame.quit()

