Skip to content

Instantly share code, notes, and snippets.

@erhhung
Last active February 29, 2024 00:28
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 erhhung/e745a1d023d75fcaecb9a827c5d1db5f to your computer and use it in GitHub Desktop.
Save erhhung/e745a1d023d75fcaecb9a827c5d1db5f to your computer and use it in GitHub Desktop.
Custom Oh-My-Posh theme

oh-my-posh-theme

"~/.config/oh-my-posh/erhhung.omp.yaml"

$schema: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version: 2
blocks:
  - type: prompt
    alignment: left
    newline: true
    segments:
      # https://ohmyposh.dev/docs/segments/text
      - type: text
        style: plain
        foreground: '#888888'
        template: ╭─
      # https://ohmyposh.dev/docs/segments/path
      - type: path
        style: diamond
        leading_diamond: 
        trailing_diamond: 
        foreground: '#e4e4e4'
        background: '#404040'
        template: '<b>{{ replaceP "^/" (replaceP "^~<#ddee80>∕</>" .Path " ") "<#ddee80>∕</>" }}</>'
        properties:
          style: full
          folder_separator_icon: '<#ddee80>∕</>'
      # https://ohmyposh.dev/docs/segments/aws
      - type: aws
        style: diamond
        trailing_diamond: 
        foreground: '#2f2f40'
        background: '#30c8a8'
        template: '  {{ .Profile }}{{ if .Region }}︙{{ .Region }}{{ end }}'
        properties:
          display_default: false
      # https://ohmyposh.dev/docs/segments/kubectl
      - type: kubectl
        style: diamond
        trailing_diamond: 
        foreground: '#e4e4e4'
        background: '#1060c0'
        template: ' ⎈ {{ .Context }}︙{{ or .Namespace "default" }}'
      # https://ohmyposh.dev/docs/segments/python
      - type: python
        style: diamond
        trailing_diamond: 
        foreground: '#96e072'
        background: '#2f2f2f'
        template: '  {{ if .Error }}{{ .Error }}{{ else }}{{ if .Venv }}{{ .Venv }} {{ end }}{{ .Full }}{{ end }}</>'
      # https://ohmyposh.dev/docs/segments/git
      - type: git
        style: diamond
        trailing_diamond: 
        foreground: '#011620'
        background: '#fffb40'
        background_templates:
          - '{{ if or (.Working.Changed) (.Staging.Changed) }}#ffeb95{{ end }}'
          - '{{ if and (gt .Ahead 0) (gt .Behind 0) }}#c5e478{{ end }}'
          - '{{ if gt .Ahead 0 }}#c792ea{{ end }}'
          - '{{ if gt .Behind 0 }}#c792ea{{ end }}'
        template: ' {{ .HEAD }} {{ if .Working.Changed }}{{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}<#ef5350>  {{ .Staging.String }}</>{{ end }}'
        properties:
          branch_icon: ''
          fetch_status: true
          fetch_upstream_icon: true
  - type: prompt
    alignment: right
    segments:
      # https://ohmyposh.dev/docs/segments/executiontime
      - type: executiontime
        style: diamond
        leading_diamond: 
        trailing_diamond: 
        foreground: '#ffffff'
        background: '#d770a0'
        template: ' {{ .FormattedMs }}'
        properties:
          style: austin
          always_enabled: true
      # https://ohmyposh.dev/docs/segments/time
      - type: time
        style: diamond
        trailing_diamond: 
        foreground: '#ffffff'
        background: '#1888c0'
        template: ' {{ .CurrentDate | date .Format | trimSuffix "m" }}'
        properties:
          time_format: 3:04:05pm
  - type: prompt
    alignment: left
    newline: true
    segments:
      # https://ohmyposh.dev/docs/segments/iterm
      - type: iterm
        style: plain
        interactive: true
        template: '{{ .PromptMark }}'
      # https://ohmyposh.dev/docs/segments/text
      - type: text
        style: plain
        foreground: '#888888'
        template: ╰─
      # https://ohmyposh.dev/docs/segments/root
      - type: root
        style: diamond
        leading_diamond: 
        trailing_diamond: 
        foreground: '#fffb38'
        background: '#ef5350'
        template: 
      # https://ohmyposh.dev/docs/segments/status
      - type: status
        style: diamond
        foreground: '#e0f8ff'
        foreground_templates:
          - '{{ if gt .Code 0 }}#ef5350{{ end }}'
        template: '<b>{{ if not .Root }}❯{{ end }}</>'
        properties:
          always_enabled: true
final_space: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment