Scripts/New-UDAvataaar.ps1

<#
.SYNOPSIS
    Sample control for UniversalDashboard.
.DESCRIPTION
    Sample control function for UniversalDashboard. This function must have an ID and return a hash table.
.PARAMETER Id
    An id for the component default value will be generated by new-guid.
.EXAMPLE
    PS C:\> <example usage>
    Explanation of what the example does
.INPUTS
    Inputs (if any)
.OUTPUTS
    Output (if any)
.NOTES
    General notes
#>

function New-UDAvataaar {
    param(
        [Parameter()]
        [string]$Id = (New-Guid).ToString(),
        [Parameter()]
        [string]$Width = "100px",
        [Parameter()]
        [string]$Height = "100px",
        [ValidateSet('Circle', 'Transparent')]
        [string]$AvatarStyle = 'Circle',
        [ValidateSet("NoHair", "Eyepatch", "Hat", "Hijab", "Turban", "WinterHat1", "WinterHat2", "WinterHat3", "WinterHat4", "LongHairBigHair", "LongHairBob", "LongHairBun", "LongHairCurly", "LongHairCurvy", "LongHairDreads", "LongHairFrida", "LongHairFro", "LongHairFroBand", "LongHairNotTooLong", "LongHairShavedSides", "LongHairMiaWallace", "LongHairStraight", "LongHairStraight2", "LongHairStraightStrand", "ShortHairDreads01", "ShortHairDreads02", "ShortHairFrizzle", "ShortHairShaggyMullet", "ShortHairShortCurly", "ShortHairShortFlat", "ShortHairShortRound", "ShortHairShortWaved", "ShortHairSides", "ShortHairTheCaesar", "ShortHairTheCaesarSidePart")]
        [string]$HairType = "NoHair",
        [ValidateSet("Blank", "Kurt", "Prescription01", "Prescription02", "Round", "Sunglasses", "Wayfarers")]
        [string]$Accessories = "Blank",
        [ValidateSet("Auburn", "Black", "Blonde", "BlondeGolden", "Brown", "BrownDark", "Platinum", "Red")]
        [string]$HairColor,
        [ValidateSet("Blank", "BeardMedium", "BeardLight", "BeardMagestic", "MoustacheFancy", "MoustacheMagnum")]
        [string]$FacialHair = "Blank",
        [ValidateSet("BlazerShirt", "BlazerSweater", "CollaeSweater", "GraphicShirt", "Hoodie", "Overall", "ShirtCrewNeck", "ShirtScoopNeck", "ShirtVNeck")]
        [string]$Clothes = "Hoodie",
        [ValidateSet("Black", "Blue01", "Blue02", "Blue03", "Gray01", "Gray02", "Heather", "PastelBlue", "PastelGreen", "PastelOrange", "PastelRed", "PastelYellow", "Pink", "Red")]
        [string]$ClothesColor = "Blue02",
        [ValidateSet("Close", "Cry", "Default", "Dizzy", "EyeRoll", "Happy", "Hearts", "Side", "Squint", "Surprised", "Wink", "WinkWacky")]
        [string]$EyeType = "Default",
        [ValidateSet("Angry", "AngryNatural", "Default", "DefaultNatural", "FlatNatural", "RaisedExcited", "RaisedExcitedNatural", "SadConcerned", "SadConcernedNatural", "UpDown", "UpDownNatural")]
        [string]$EyebrowType = "Default",
        [ValidateSet("Concerned", "Default", "Disbelief", "Eating", "Grimace", "Sad", "ScreamOpen", "Serious", "Smile", "Tongue", "Twinkle", "Vomit")]
        [string]$MouthType = "Default",
        [ValidateSet("Tanned", "Yellow", "Pale", "Light", "Brown", "DarkBrown", "Black")]
        [string]$SkinColor = "Light"
    )

    End {

        @{
            # The AssetID of the main JS File
            assetId         = $AssetId
            # Tell UD this is a plugin
            isPlugin        = $true
            # This ID must be the same as the one used in the JavaScript to register the control with UD
            type            = "UD-Avataaar"
            # An ID is mandatory
            id              = $Id

            # This is where you can put any other properties. They are passed to the React control's props
            # The keys are case-sensitive in JS.
            width           = $Width
            height          = $Height
            avatarStyle     = $AvatarStyle
            topType         = $HairType
            accessoriesType = $Accessories
            hairColor       = $HairColor
            facialHairType  = $FacialHair
            clotheType      = $Clothes
            clotheColor     = $ClothesColor
            eyeType         = $EyeType
            eyebrowType     = $EyebrowType
            mouthType       = $MouthType
            skinColor       = $SkinColor
        }

    }
}