Skip to main content

Customize

The standard initialization sets Oh My Posh' default theme. This configuration is embedded and thus kept up-to-date with Oh My Posh.

To set a new config/theme you need to change the --config option of the oh-my-posh init <shell> line in your profile or .<shell>rc script (see prompt) and point it to the location of a predefined theme or custom configuration.

There are two possible values the --config flag can handle:

  • a path to a local configuration file
--config 'C:/Users/Posh/jandedobbeleer.omp.json'
  • a URL pointing to a remote config
--config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json'

Set the configuration

The example below use a local path to the jandedobbeleer theme, adjust the --config value to reflect your configuration file, local or remote.

Adjust the Oh My Posh init line in your $PROFILE by adding the --config flag with the location of your configuration.

oh-my-posh init pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression

Once altered, reload your profile for the changes to take effect.

. $PROFILE
info

When the above command gives an error, make sure to create the profile first and add the oh-my-posh init above.

New-Item -Path $PROFILE -Type File -Force

In this scenario, it can also be that PowerShell blocks running local scripts. To solve that, set PowerShell to only require remote scripts to be signed using Set-ExecutionPolicy RemoteSigned, or sign the profile.

wsl

When using oh-my-posh in Windows and the WSL, know that you can share your theme with the WSL by pointing to a theme in your Windows user's home folder.

Inside the WSL, you can find your Windows user's home folder here: /mnt/c/Users/<WINDOWSUSERNAME>.

Themes

The Windows and homebrew installers also bundle the predefined configurations (themes). You can use the following way to reference them directly. This will keep them up-to-date and compatible with future updates.

For example, to use the jandedobbeleer theme, alter the init line like this (powershell):

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression

Custom configuration

Maybe there's a theme you like, but you don't fancy the colors. Or, maybe there's a segment you want to tweak/add, or replace some of the icons with a different one. Whatever the case, read through available options first, by starting with the configuration.

You can export the current theme (default, or set via --config) to the format you like (json, yaml, or toml) which can be used to tweak and store as your own custom configuration.

oh-my-posh config export --output ~/.mytheme.omp.json
caution

Be careful not to adjust the theme files in their original location as they're updated together with Oh My Posh which will remove your customizations. Always copy, or export them and save the new configuration outside of the Oh My Posh internal themes folder.

Read the docs

To fully understand how to customize a theme, read through the documentation in the configuration and segments sections. The configuration section covers the basic building blocks and concepts of Oh My Posh themes, while the segments section covers how to configure each available segment.