Created
April 13, 2021 21:14
-
-
Save royashbrook/393d7bdaf83582498a8aad9f7a92e693 to your computer and use it in GitHub Desktop.
Set a random Oh My Posh theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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