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:

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login