Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created January 2, 2025 08:23
Show Gist options
  • Save adamdriscoll/6521a31a427cea45cdea4cc5b363964c to your computer and use it in GitHub Desktop.
Save adamdriscoll/6521a31a427cea45cdea4cc5b363964c to your computer and use it in GitHub Desktop.
HTML5 Color Picker for PowerShell Universal
function New-UDColorPicker {
[CmdletBinding()]
param(
[Parameter()]
[string]$Id = [Guid]::NewGuid(),
[Parameter()]
[ScriptBlock]$OnChange,
[Parameter()]
[string]$Value,
[Parameter()]
[Hashtable]$Style
)
New-UDElement -Id $Id -Tag "input" -Attributes @{
value = $Value
type = "color"
onChange = $OnChange
style = $Style
}
}
New-UDApp -Content {
New-UDColorPicker -Id 'colorPicker' -OnChange {
Show-UDToast $EventData -Position topLeft -Persistent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment