###### Tags: `PowerShell` [Oh My Posh](https://ohmyposh.dev/) [影片教學參考](https://www.youtube.com/watch?v=OL9Mr4dzIWU) # PWSH終端機更改主題 ## 安裝 PowerShell 7 https://github.com/PowerShell/PowerShell ## 安裝 Oh My Posh ```bash= winget install JanDeDobbeleer.OhMyPosh -s winget ``` or Powershell ```= Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1')) ``` 重新開啟 Windows Terminal 輸入以下指令應用修改, ```bash code $Profile ``` ## 增加以下內容,儲存後關閉 ``` oh-my-posh init pwsh | Invoke-Expression ``` ## 安裝 Patched 字型 為了 Oh My Posh 的主題可以正常顯示字型與圖示,下載以下四個字型並安裝: [MesloLGS NF Regular.ttf](https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Regular.ttf) [MesloLGS NF Bold.ttf](https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Bold.ttf) [MesloLGS NF Italic.ttf](https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Italic.ttf) [MesloLGS NF Bold Italic.ttf](https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Bold%20Italic.ttf) 終端機字體選MesloLGS NF ## 查看內建的主題與預覽 ```bash Get-PoshThemes ``` ## 更改 $Profile 內容來修改主題 ```bash oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\[主題名稱].omp.json" | Invoke-Expression ``` ex: ```bash oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\microverse-power.omp.json" | Invoke-Expression ``` or ```bash oh-my-posh init pwsh --config "C:\Users\rodes\Desktop\plague.omp.json" | Invoke-Expression ``` ## 在powershell開啟json設定 ```setting.json= "profiles": { "defaults": { // Put settings here that you want to apply to all profiles. // 啟用視窗透明度(這邊開了背景圖會比較白) "useAcrylic": true, "opacity": 50, // 背景圖片 "backgroundImage": "D:\\wallpaper\\Zephyrus G14_1920x1080.jpg", // 背景透明度 "backgroundImageOpacity": 0.2, // 主題設定 "colorScheme": "Tango Dark", // 字型設定(請找PowerLine字型) "fontFace": "Cascadia Code PL" } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up