get PWA bg color from custom.css if available

Hunter
Monday, April 6th, 2026 at 4:11 PM

build.py+18-19

build.py
52  SCRIPT_DIR = Path(__file__).parent.absolute()
53  TRACKS_JSON = SCRIPT_DIR / "mix" / "tracks.json"
54  STYLES_CSS = SCRIPT_DIR / "resources" / "styles.css"
55 +CUSTOM_CSS = SCRIPT_DIR / "mix" / "custom.css"
56  
57  
58  def get_background_color():
   -	"""Extract the --background CSS variable from styles.css"""
   -	if not STYLES_CSS.exists():
   -		print("Warning: styles.css not found. Using default color.")
   -		return "#080a0c"
   -
   -	with open(STYLES_CSS, 'r', encoding='utf-8') as f:
   -		content = f.read()
   -
   -	# Look for --background: <color>; pattern
   -	match = re.search(
   -		r'--background:\s*([#a-zA-Z0-9(),.\s]+?)\s*;',
   -		content
   -	)
   -	if match:
   -		color = match.group(1).strip()
   -		print(f"Found background color in styles.css: {color}")
   -		return color
   -
   -	print("Warning: --background not found in styles.css. Using default color.")
59 +	"""Extract the --background CSS variable, preferring custom.css over styles.css"""
60 +	# Check custom.css first (overrides styles.css)
61 +	for css_file in [CUSTOM_CSS, STYLES_CSS]:
62 +		if not css_file.exists():
63 +			continue
64 +		with open(css_file, 'r', encoding='utf-8') as f:
65 +			content = f.read()
66 +		match = re.search(
67 +			r'--background:\s*([#a-zA-Z0-9(),.\s]+?)\s*;',
68 +			content
69 +		)
70 +		if match:
71 +			color = match.group(1).strip()
72 +			print(f"Found background color in {css_file.name}: {color}")
73 +			return color
74 +
75 +	print("Warning: --background not found in any CSS file. Using default color.")
76  	return "#080a0c"
77  
78