Same thing @BoSen29 mentioned in below topic about !important.
Lucky me I have been using Default theme available since 2.5.3 along with colored elements in my entire dashboard it works fine.
I tested other components yesterday with Darkrounded or Darkdefault result was same.
Test code:
If (-Not (Get-Module UniversalDashboard.Community -ErrorAction SilentlyContinue)) {
Import-Module UniversalDashboard.Community
}
$HomePage = New-UDPage -Name “HomePage” -Title “HomePage” -Icon home -Content {
New-UDRow -Columns {
New-UDColumn -Size 12 -Content {
New-UDColumn -Size 3 -Endpoint {
New-UDCard -Title “Services” -BackgroundColor ‘#FFDEAD’ -FontColor ‘#A0522D’ -Endpoint {
New-UDIconButton -Icon (New-UDIcon -Icon earlybirds -Size 3x -Style @{ color = ‘#DAA520’}) -OnClick {
Show-UDModal -Header {
New-UDHeading -Size 4 -Text “Service Status”
} -Content {
New-UDTable -Headers @(“DisplayName”, “Status”) -Endpoint {
$status = Get-Service | Select-Object “DisplayName”, “Status” | Where-Object {$_.DisplayName -like “A*”}
$Status | ForEach-Object {
$BgColor = 'White'
$FontColor = 'Black'
if ($_.Status -ne 'Running') {
$BgColor = 'red'
$FontColor = 'White'
}
[PSCustomObject]@{
DisplayName = $_.DisplayName.ToString()
Status = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.Status.ToString() }
}
} | Out-UDTableData -Property @("DisplayName", "Status")
} -Style highlight
New-UDButton -Text 'Close' -OnClick {
Hide-UDModal
}
} -Persistent
}
} -TextAlignment center
} #-AutoRefresh -RefreshInterval 5
}
}
New-UDRow -Columns {
New-UDTabContainer -Tabs {
New-UDTab -Text "Service-DB Status" -Content {
New-UDTable -Headers @("DisplayName", "Status") -Endpoint {
$import = Get-Service | Select-Object "DisplayName", "Status" | Where-Object {$_.DisplayName -like "A*"}
$import | ForEach-Object {
$BgColor = 'White'
$FontColor = 'Black'
if ($_.Status -ne 'Running') {
$BgColor = 'red'
$FontColor = 'White'
}
[PSCustomObject]@{
DisplayName = $_.DisplayName.ToString()
Status = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.Status.ToString() }
}
} | Out-UDTableData -Property @("DisplayName", "Status")
} -Style highlight
New-UDButton -Text 'Close' -OnClick {
Hide-UDModal
}
}
}
}
}
$Status =
New-UDPage -Name “Status Check” -Title “Status Check” -Icon bomb -Content {
New-UDColumn -SmallSize 6 -MediumSize 6 -LargeSize 6 -Content {
New-UDCollapsible -Popout -Items {
New-UDCollapsibleItem -Title “Service Status” -Icon server -Content {
New-UDHeading -Text “Show services status”
New-UDButton -Floating -Icon angle_double_right -IconAlignment right -OnClick (
New-UDEndpoint -Endpoint {
Invoke-UDRedirect -Url “/Status-Check/SerStatus”
}
)
}
}
}
}
$SerStatus = New-UDPage -Url “/Status-Check/SerStatus” -Endpoint {
New-UDColumn -SmallSize 6 -MediumSize 6 -LargeSize 6 -Content {
New-UDCard -Content {
#New-UDHeading -Color “#01CCFF” -Text “Shows the status of Availability Group Sync status.” -Size 6
New-UDInput -Id “card3” -Title “Enter Server Name” -Content {
New-UDInputField -Type ‘textbox’ -Name ‘ServerName’ -Placeholder ‘Enter Server Name’
} -Endpoint {
param($servername)
New-UDInputAction -RedirectUrl “/SerStatus/$servername”
}
New-UDButton -Text “Back” -Icon backward -IconAlignment right -OnClick (
New-UDEndpoint -Endpoint {
Invoke-UDRedirect -Url “/Status-Check”
}
)
}
}
}
$SerDynamic = New-UDPage -Url “/SerStatus/:ServerName” -Endpoint {
param($servername)
New-UDRow -Columns {
New-UDTabContainer -Tabs {
New-UDTab -Text “Service-DB Status” -Content {
New-UDTable -Headers @(“DisplayName”, “Status”) -Endpoint {
$status = Get-Service -ComputerName $servername | Select-Object “DisplayName”, “Status” | Where-Object {$_.DisplayName -like “A*”}
$Status | ForEach-Object {
$BgColor = 'White'
$FontColor = 'Black'
if ($_.Status -ne 'Running') {
$BgColor = 'red'
$FontColor = 'White'
}
[PSCustomObject]@{
DisplayName = $_.DisplayName.ToString()
Status = New-UDElement -Tag 'div' -Attributes @{ style = @{ 'backgroundColor' = $BgColor; color = $fontColor } } -Content { $_.Status.ToString() }
}
} | Out-UDTableData -Property @("DisplayName", "Status")
} -Style highlight
}
}
New-UDButton -Text "Back" -Icon backward -IconAlignment right -OnClick (
New-UDEndpoint -Endpoint {
Invoke-UDRedirect -Url "/Status-Check/SerStatus"
}
)
}
}
$Theme = Get-UDTheme Darkdefault
$Dashboard = New-UDDashboard -Title “Service Status” -Pages @($HomePage, $Status, $SerStatus, $SerDynamic) -Theme $Theme
Start-UDDashboard -Name “Status” -Port 10002 -Dashboard $Dashboard -AutoReload