UDStyle | Card Background Colour

Product: PowerShell Universal
Version: 4.1.2

Is there an issue with setting the New-UDCard Style?

I’m tring to set the background colour and can’t get it to work so i copied/pasted the example from the docs (https://docs.powershelluniversal.com/userinterfaces/themes/styles)

New-UDStyle -Style '
    padding: 32px;
    background-color: hotpink;
    font-size: 24px;
    border-radius: 4px;
    &:hover {
      color: white;
    }
    .card {
        background-color: green !important;   
    }' -Content {
        New-UDCard -Title 'Test' -Content {
            "Hello"
        }
    }

And that too doesn’t set the card background colour to green?

I have also tried this example to no avail (New-UDCard Styles - #2 by insomniacc)

new-udcard -Style @{width = 200; height = 80;"background-color"= "green"} -Content {
    New-UDElement -Tag div -Attributes @{style=@{width = "100%";"text-align"="center"}} -Content {
        New-UDTypography -text "test" -Variant h5
    }
}

Cheers,
Jamie

We’ll have to update the docs. Here’s an example that works.

New-UDStyle -Style '
    padding: 32px;
    background-color: hotpink;
    font-size: 24px;
    border-radius: 4px;
    &:hover {
      color: white;
    }
    .MuiCardHeader-root {
        background-color: green !important;   
    }
    .MuiCardContent-root {
        background-color: green !important;   
    }' -Content {
        New-UDCard -Title 'Test' -Content {
            "Hello"
        }
    }
1 Like

Thank you, that worked perfectly.