feat(text_input): switch color definitions to settings file

This commit is contained in:
Kevin Baumgartner
2026-05-07 22:18:10 +02:00
parent 496c74fed2
commit b15c5b5e28
2 changed files with 21 additions and 7 deletions
+11 -6
View File
@@ -1,5 +1,10 @@
import pygame
from button import Button
from settings import (COLOR_BUTTON,
COLOR_BUTTON_HOVER,
COLOR_STARTSCREEN_BACKGROUND,
COLOR_STARTSCREEN_FONT_TITLE,
COLOR_STARTSCREEN_FONT_LABEL)
from text_input import TextInput
class Startscreen:
@@ -8,8 +13,8 @@ class Startscreen:
self.font_title = pygame.font.SysFont("Arial", 36)
self.font_label = pygame.font.SysFont("Arial", 20)
self.button_color = (0, 255, 0)
self.button_hover_color = (200, 255, 0)
self.button_color = COLOR_BUTTON
self.button_hover_color = COLOR_BUTTON_HOVER
self.player_name = ""
@@ -30,7 +35,7 @@ class Startscreen:
self.button_hover_color)
self.text_input_name = TextInput(400,
70,
40,
20,
240)
@@ -58,12 +63,12 @@ class Startscreen:
return "game"
# set background color
self.screen.fill((0, 0, 0))
self.screen.fill(COLOR_STARTSCREEN_BACKGROUND)
# set title and intro/welcome message
title = self.font_title.render("SILENT FH", True, (0, 255, 0))
title = self.font_title.render("SILENT FH", True, COLOR_STARTSCREEN_FONT_TITLE)
self.screen.blit(title, (10, 10))
message = self.font_label.render("Welcome to FH - Study with purpose", True, (0, 255, 255))
message = self.font_label.render("Welcome to FH - Study with purpose", True, COLOR_STARTSCREEN_FONT_LABEL)
# draw buttons and get click state
button_start_pressed = self.button_start.draw(self.screen)