New-UDHeading does not support dark theme

When switching to dark mode, New-UDHeading does not change color. The tekst stays black. Is there a way to have New-UDHeading to support dark theme?

Also, is there a way to detect if dark mode is enabled/disabled?

Product: PowerShell Universal
Version: 3.9.6

I’d use New-UDTypography with the -Variant h1 parameter. I think we should probably just update heading to use this instead of what it is currently doing.

We currently don’t set the current theme value into the PS side of things. The theme value is present in session storage if you look in the browser dev tools. That said, I’ll open an issue for this since this would be useful.

1 Like

To solve the issue to know if dark mode is used, i created this solution which i placed in the appbar.

New-UDCheckBox -Checked $Session:ThemeNightMode -Icon $(New-UDIcon -Icon moon -Solid) -CheckedIcon $(New-UDIcon -Icon Sun -Solid) -OnChange {
	$Theme = Get-UDTheme -Name AntDesign
	if ($EventData) {
		$Theme = $Theme.dark
	else {
		$Theme = $Theme.light
	$Session:ThemeNightMode = $EventData
	Set-UDTheme -Theme $Theme

This way i can execute actions when nightmode is enabled, for instance a page reload when -style is used on an element.

On a side note:
If $Theme is empty, or not as expected, the dashboards will be down until i clear the local cache in the browser.