Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royashbrook/393d7bdaf83582498a8aad9f7a92e693 to your computer and use it in GitHub Desktop.
Save royashbrook/393d7bdaf83582498a8aad9f7a92e693 to your computer and use it in GitHub Desktop.
Set a random Oh My Posh theme
#open profile with code $profile or notepad $profile and paste in the following
#note you will need to have installed oh-my-posh already
#see https://ohmyposh.dev/ for details
Import-Module oh-my-posh
function Get-ThemeList{
$themeurl = "https://github.com/JanDeDobbeleer/oh-my-posh/tree/main/themes"
$ProgressPreference = 'SilentlyContinue'
$links = (iwr $themeurl).links
$ProgressPreference = 'Continue'
($links | where title -like *omp.json).title -Replace ".omp.json",""
}
function Set-RandomPoshPrompt{
if (!$global:themes){
$global:themes = Get-ThemeList
}
$randomtheme = Get-Random $themes
Set-PoshPrompt $randomtheme
"Random them chosen: $randomtheme"
}
Set-RandomPoshPrompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment