1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extends Node2D
var bg
var label: Label


func configure(text: String, background: Color, text_color: Color = Color.WHITE):
	if !bg:
		bg = $ColorRect
	if !label:
		label = $Label
	bg.color = background
	label.text = text
	if text_color != Color.WHITE:
		label.add_theme_color_override("font_color", text_color)

func update_colors(new_number):
	if new_number == 0:
		configure("", Constants.BACKGROUND_COLOR_CELL_EMPTY)
	else:
		configure(
			str(new_number),
			Constants.BACKGROUND_COLOR_ARRAY[Constants.cells[new_number]],
			Constants.CELL_COLOR_ARRAY[Constants.cells[new_number]]
		)