@tool
class_name CheckerContainer extends PanelContainer
## PanelContainer that sets its theme based on its parent parity

@export var even_variation := "CheckerContainerEven"
@export var odd_variation := "CheckerContainerOdd"


func _ready() -> void:
	get_parent().child_order_changed.connect(_recompute)


func _is_even_child() -> bool:
	var parent := get_parent()
	return parent.get_children().find(self) % 2 == 0 if parent else false


func _recompute() -> void:
	theme_type_variation = even_variation if _is_even_child() else odd_variation
