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
+9
View File
@@ -12,3 +12,12 @@ COLOR_DOOR_BEIGE = (245, 245, 220)
COLOR_DOOR_BORDER = (100, 90, 80) COLOR_DOOR_BORDER = (100, 90, 80)
COLOR_HP_BAR_GREEN = (0, 255, 0) COLOR_HP_BAR_GREEN = (0, 255, 0)
COLOR_HP_BAR_BG = (50, 50, 50) COLOR_HP_BAR_BG = (50, 50, 50)
# --- BUTTONS ---
COLOR_BUTTON = (0, 255, 0)
COLOR_BUTTON_HOVER = (200, 255, 0)
# --- STARTSCREEN ---
COLOR_STARTSCREEN_BACKGROUND = ((0, 0, 0))
COLOR_STARTSCREEN_FONT_TITLE = (0, 255, 0)
COLOR_STARTSCREEN_FONT_LABEL = (0, 255, 255)
+11 -6
View File
@@ -1,5 +1,10 @@
import pygame import pygame
from button import Button 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 from text_input import TextInput
class Startscreen: class Startscreen:
@@ -8,8 +13,8 @@ class Startscreen:
self.font_title = pygame.font.SysFont("Arial", 36) self.font_title = pygame.font.SysFont("Arial", 36)
self.font_label = pygame.font.SysFont("Arial", 20) self.font_label = pygame.font.SysFont("Arial", 20)
self.button_color = (0, 255, 0) self.button_color = COLOR_BUTTON
self.button_hover_color = (200, 255, 0) self.button_hover_color = COLOR_BUTTON_HOVER
self.player_name = "" self.player_name = ""
@@ -30,7 +35,7 @@ class Startscreen:
self.button_hover_color) self.button_hover_color)
self.text_input_name = TextInput(400, self.text_input_name = TextInput(400,
70, 40,
20, 20,
240) 240)
@@ -58,12 +63,12 @@ class Startscreen:
return "game" return "game"
# set background color # set background color
self.screen.fill((0, 0, 0)) self.screen.fill(COLOR_STARTSCREEN_BACKGROUND)
# set title and intro/welcome message # 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)) 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 # draw buttons and get click state
button_start_pressed = self.button_start.draw(self.screen) button_start_pressed = self.button_start.draw(self.screen)