Change desktop background color
-
You can use this with the TRIGGERcmd Smart Home skill's ability to pass a color as the parameter (not just on or off).
param ( [string]$ColorName = "red" ) # Define a hashtable mapping color names to hexadecimal color codes $ColorHexMap = @{ "red" = "0x2a2490" "blue" = "0xFF0000" "green" = "0x008000" "purple" = "0xA52A2A" "yellow" = "0x70ffe6" "brown" = "0x2d4159" "black" = "0x000000" "white" = "0xFFFFFF" } # Check if the provided color name exists in the hashtable if ($ColorHexMap.ContainsKey($ColorName)) { $ColorHex = $ColorHexMap[$ColorName] } else { Write-Host "Invalid color name. Please use 'red,' 'blue,' 'green' etc." exit } Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class PInvoke { [DllImport("user32.dll")] public static extern bool SetSysColors(int cElements, int[] lpaElements, int[] lpaRgbValues); } "@ [PInvoke]::SetSysColors(1, @(1), @($ColorHex))
When I said, Alexa, turn desktop green it turned my desktop green:
When I said, Alexa, turn desktop blue it turned my desktop blue: