New-UDGrid background color question

Hi,

I’m trying to style the dashboards similar to the Powershell Universal Admin page using a gray background for the dashboard but placing the components in white background papers.

I’ve tried

  1. using UDPaper but it has the habit to change the style of some components e.g. using “New-UDTextbox -FullWidth” inside a UDPaper will not use the full width of its grid. I assume it inherits other style settings from the Paper, not just the background color.

  2. using UDStyle to set the background
    In that case all the alignment stays as intended but the white background will remain when switching to dark mode.
    New-UDStyle -Style 'background-color: #FFFFFF' -Content {New-UDGrid -Container -Content {}

What’s the best option to simply change the background color within a UDGrid but respect the light/dark mode without changing any other attributes like width etc?

Product: PowerShell Universal
Version: 3.4.3

You can use the theme to set the background and change it based on dark and light.

$Theme = @{
    light = @{
        palette = @{
            primary    = @{
                main = '#876a38'
            }
            background = @{
                default = 'red'
            }
        }
    }
    dark  = @{
        palette = @{
            primary    = @{
                main = '#876a38'
            }
            background = @{
                default = 'blue'
            }
        }
    }
}
New-UDDashboard -Theme $Theme -Title 'Hello' -Content {
    New-UDButton -Text 'Hello' 
}