private/Convert/Convert-MediaColorToDrawingColor.ps1
function Convert-MediaColorToDrawingColor { <# .SYNOPSIS Converts a System.Windows.Media.Color to a System.Drawing.Color. .DESCRIPTION The Convert-MediaColorToDrawingColor function takes a WPF-compatible Media.Color object and returns its equivalent in the System.Drawing.Color structure. This is useful for interoperability between WPF and WinForms/GDI-based tools. .PARAMETER MediaColor A System.Windows.Media.Color object to convert. .EXAMPLE $media = [System.Windows.Media.Colors]::DarkSlateBlue $drawing = Convert-MediaColorToDrawingColor -MediaColor $media Converts a WPF color into a GDI-compatible color structure. .NOTES Author: Jeff Pollock GitHub: https://github.com/phriendx/ISEColorTheme.cmdlets Website: https://pxlabs.info #> param ([System.Windows.Media.Color]$MediaColor) return [System.Drawing.Color]::FromArgb($MediaColor.A, $MediaColor.R, $MediaColor.G, $MediaColor.B) } |