this fixes widget colours not updating with theme changes -> if, for instance, an offscreen widget is created, this results in a reparenting (to null)
and that in turn creates a palette changed event ... which was being intepretted as a custom palette being set and that would disable future updates
due to theme changes.
this also introduces a small helper which computes the palettes once for use by all widgets as a small performance improvement.
BUG:261967