Skip to content

Instantly share code, notes, and snippets.

@pedrojreis
Last active November 23, 2023 14:39
Show Gist options
  • Save pedrojreis/e968ecdf177b82805a6aa665a631479f to your computer and use it in GitHub Desktop.
Save pedrojreis/e968ecdf177b82805a6aa665a631479f to your computer and use it in GitHub Desktop.
Oh-My-Posh Theme for PowerShell

PowerShell Profile

This is a small adaptation of a Oh-My-Posh Theme according to my needs.

Screenshot 2023-07-28 131649

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#d3d7cf",
          "foreground": "#000000",
          "leading_diamond": "\u256d\u2500\ue0b2",
          "style": "diamond",
          "template": " {{ if .WSL }}WSL at {{ end }}{{.Icon}} ",
          "type": "os"
        },
        {
          "background": "#3465a4",
          "foreground": "#e4e4e4",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "home_icon": "~",
            "style": "full"
          },
          "style": "powerline",
          "template": " \uf07c {{ .Path }} ",
          "type": "path"
        },
        {
          "background": "#4e9a06",
          "background_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}#c4a000{{ end }}",
            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#f26d50{{ end }}",
            "{{ if gt .Ahead 0 }}#89d1dc{{ end }}",
            "{{ if gt .Behind 0 }}#4e9a06{{ end }}"
          ],
          "foreground": "#000000",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "branch_icon": "\uf126 ",
            "fetch_stash_count": true,
            "fetch_status": true,
            "fetch_upstream_icon": true
          },
          "style": "powerline",
          "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ",
          "type": "git"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "right",
      "segments": [
        {
          "background": "#689f63",
          "foreground": "#ffffff",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "fetch_version": true
          },
          "style": "powerline",
          "template": " {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} \ue718 ",
          "type": "node"
        },
        {
          "type": "dotnet",
          "style": "powerline",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "foreground": "#000000",
          "background": "#3465a4",
          "template": "  {{ .Full }} "
        },
        {
          "background": "#00acd7",
          "foreground": "#111111",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "fetch_version": true
          },
          "style": "powerline",
          "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue627 ",
          "type": "go"
        },
        {
          "background": "#4063D8",
          "foreground": "#111111",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "fetch_version": true
          },
          "style": "powerline",
          "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue624 ",
          "type": "julia"
        },
        {
          "background": "#FFDE57",
          "foreground": "#111111",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "display_mode": "files",
            "fetch_virtual_env": false
          },
          "style": "powerline",
          "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue235 ",
          "type": "python"
        },
        {
          "background": "#AE1401",
          "foreground": "#ffffff",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "display_mode": "files",
            "fetch_version": true
          },
          "style": "powerline",
          "template": " {{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }} \ue791 ",
          "type": "ruby"
        },
        {
          "type": "docker",
          "style": "powerline",
          "powerline_symbol": "\ue0b2",
          "invert_powerline": true,
          "foreground": "#000000",
          "background": "#0B59E7",
          "template": "  {{ .Context }} "
        },
        {
          "type": "kubectl",
          "style": "powerline",
          "powerline_symbol": "\ue0b2",
          "invert_powerline": true,
          "foreground": "#000000",
          "background": "#0B59E7",
          "template": " ﴱ {{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}} ",
          "properties": {
            "context_aliases": {
              "arn:aws:eks:eu-west-1:1234567890:cluster/posh": "posh"
            }
          }
        },
        {
          "type": "terraform",
          "style": "powerline",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "foreground": "#000000",
          "background": "#ebcc34",
          "template": "󱁢 {{.WorkspaceName}} "
        },
        {
          "background": "#9ec3f0",
          "foreground": "#000000",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "display_mode": "files",
            "fetch_version": false
          },
          "style": "powerline",
          "template": " ﴃ {{ .Name }} ",
          "type": "az"
        },
        {
          "type": "gcp",
          "style": "powerline",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "foreground": "#111111",
          "background": "#4285F4",
          "template": "  {{.Project}}"
        },
        {
          "background_templates": [
            "{{if contains \"default\" .Profile}}#FFA400{{end}}",
            "{{if contains \"jan\" .Profile}}#f1184c{{end}}"
          ],
          "foreground": "#ffffff",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "display_default": false
          },
          "style": "powerline",
          "template": " {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} \ue7ad ",
          "type": "aws"
        },
        {
          "background": "#ffff66",
          "foreground": "#111111",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "style": "powerline",
          "template": " \uf0ad ",
          "type": "root"
        },
        {
          "background": "#c4a000",
          "foreground": "#000000",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "style": "powerline",
          "template": " {{ .FormattedMs }} \uf252 ",
          "type": "executiontime"
        },
        {
          "background": "#000000",
          "background_templates": ["{{ if gt .Code 0 }}#cc2222{{ end }}"],
          "foreground": "#d3d7cf",
          "invert_powerline": true,
          "powerline_symbol": "\ue0b2",
          "properties": {
            "always_enabled": true
          },
          "style": "powerline",
          "template": " {{ if gt .Code 0 }}{{ reason .Code }}{{ else }}\u2714{{ end }} ",
          "type": "status"
        },
        {
          "background": "#d3d7cf",
          "foreground": "#000000",
          "invert_powerline": true,
          "style": "diamond",
          "template": " {{ .CurrentDate | date .Format }} \uf017 ",
          "trailing_diamond": "\ue0b0\u2500\u256e",
          "type": "time"
        }
      ],
      "type": "prompt"
    },
    {
      "alignment": "left",
      "newline": true,
      "segments": [
        {
          "foreground": "#d3d7cf",
          "style": "plain",
          "template": "\u2570\u2500",
          "type": "text"
        }
      ],
      "type": "prompt"
    },
    {
      "segments": [
        {
          "foreground": "#d3d7cf",
          "style": "plain",
          "template": "\u2500\u256f",
          "type": "text"
        }
      ],
      "type": "rprompt"
    }
  ],
  "final_space": true,
  "console_title_template": "PowerShell 💻",
  "version": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment