feat: add default theme

This commit is contained in:
Jan De Dobbeleer 2022-03-16 14:03:33 +01:00 committed by Jan De Dobbeleer
parent 75e90329f4
commit 0ec78b991c
4 changed files with 198 additions and 8 deletions

View file

@ -38,7 +38,7 @@ notepad $PROFILE
Then add the following line.
```powershell
oh-my-posh prompt init pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json | Invoke-Expression
oh-my-posh prompt init pwsh | Invoke-Expression
```
Once added, reload your profile for the changes to take effect.
@ -71,7 +71,7 @@ Use the full path to the config file, not the relative path.
:::
```lua title="oh-my-posh.lua"
load(io.popen('oh-my-posh prompt init cmd --config="https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json"'):read("*a"))()
load(io.popen('oh-my-posh prompt init cmd'):read("*a"))()
```
Once added, restart cmd for the changes to take effect.
@ -82,7 +82,7 @@ Once added, restart cmd for the changes to take effect.
Add the following to `~/.zshrc`:
```bash
eval "$(oh-my-posh prompt init zsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json)"
eval "$(oh-my-posh prompt init zsh)"
```
Once added, reload your profile for the changes to take effect.
@ -97,7 +97,7 @@ source ~/.zshrc
Add the following to `~/.bashrc` (could be `~/.profile` or `~/.bash_profile` depending on your environment):
```bash
eval "$(oh-my-posh prompt init bash --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json)"
eval "$(oh-my-posh prompt init bash)"
```
Once added, reload your profile for the changes to take effect.
@ -122,7 +122,7 @@ It's advised to be on the latest version of fish. Versions below 3.1.2 have issu
Initialize Oh My Posh in `~/.config/fish/config.fish`:
```bash
oh-my-posh prompt init fish --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v(oh-my-posh --version)/themes/jandedobbeleer.omp.json | source
oh-my-posh prompt init fish | source
```
Once added, reload your config for the changes to take effect.
@ -139,13 +139,13 @@ Set the prompt and restart nu shell:
**Nu < 0.32.0**
```bash
config set prompt "= `{{$(oh-my-posh prompt print primary --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json | str collect)}}`"
config set prompt "= `{{$(oh-my-posh prompt print primary | str collect)}}`"
```
**Nu >= 0.32.0**
```bash
config set prompt "(oh-my-posh prompt print primary --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json | str collect)"
config set prompt "(oh-my-posh prompt print primary | str collect)"
```
Restart nu shell for the changes to take effect.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -237,7 +237,7 @@ func (env *ShellEnvironment) resolveConfigPath() {
env.CmdFlags.Config = env.Getenv("POSH_THEME")
}
if len(env.CmdFlags.Config) == 0 {
env.CmdFlags.Config = fmt.Sprintf("https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v%s/themes/jandedobbeleer.omp.json", env.Version)
env.CmdFlags.Config = fmt.Sprintf("https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v%s/themes/default.omp.json", env.Version)
}
location, err := url.ParseRequestURI(env.CmdFlags.Config)
if err == nil {

190
themes/default.omp.json Normal file
View file

@ -0,0 +1,190 @@
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"palette": {
"yellow": "#F3AE35",
"orange": "#F07623",
"blue": "#4B95E9",
"black": "#262B44",
"green": "#59C9A5",
"white": "#E0DEF4",
"red": "#D81E5B"
},
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "p:yellow",
"foreground": "p:black",
"leading_diamond": "\ue0b6",
"properties": {
"display_host": false,
"template": " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }} "
},
"style": "diamond",
"trailing_diamond": "\ue0b0",
"type": "session"
},
{
"background": "p:orange",
"foreground": "p:white",
"powerline_symbol": "\ue0b0",
"properties": {
"home_icon": "~",
"style": "folder",
"template": " \uf74a {{ path .Path .Location }} "
},
"style": "powerline",
"type": "path"
},
{
"background": "p:green",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
"{{ if gt .Ahead 0 }}#49416D{{ end }}",
"{{ if gt .Behind 0 }}#7A306C{{ end }}"
],
"foreground": "p:black",
"foreground_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
"{{ if gt .Ahead 0 }}p:white{{ end }}"
],
"powerline_symbol": "\ue0b0",
"properties": {
"branch_max_length": 25,
"fetch_status": true,
"fetch_upstream_icon": true,
"github_icon": "\uf7a3",
"template": " {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }} "
},
"style": "powerline",
"type": "git"
},
{
"background": "p:yellow",
"foreground": "p:white",
"powerline_symbol": "\ue0b0",
"properties": {
"root_icon": "\uf0ad",
"template": " \uf0e7 "
},
"style": "powerline",
"type": "root"
},
{
"background": "p:blue",
"background_templates": ["{{ if gt .Code 0 }}p:red{{ end }}"],
"foreground": "p:white",
"properties": {
"always_enabled": true,
"template": " {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} "
},
"style": "diamond",
"leading_diamond": "<transparent,background>\ue0b0</>",
"trailing_diamond": "\ue0b4",
"type": "exit"
}
],
"type": "prompt"
},
{
"segments": [
{
"background": "transparent",
"foreground": "p:green",
"properties": {
"display_mode": "files",
"fetch_package_manager": false,
"home_enabled": false,
"template": "\uf898 "
},
"style": "plain",
"type": "node"
},
{
"background": "transparent",
"foreground": "p:blue",
"properties": {
"fetch_version": false,
"template": "\ufcd1 "
},
"style": "powerline",
"type": "go"
},
{
"background": "transparent",
"foreground": "p:yellow",
"properties": {
"display_mode": "files",
"fetch_version": true,
"fetch_virtual_env": false,
"template": "\ue235 "
},
"style": "plain",
"type": "python"
},
{
"background": "transparent",
"foreground": "p:white",
"properties": {
"template": "in <p:blue><b>{{ .Name }}</b></> "
},
"style": "plain",
"type": "shell"
},
{
"background": "transparent",
"foreground": "p:white",
"properties": {
"template": "at <p:blue><b>{{ .CurrentDate | date \"15:04:05\" }}</b></>"
},
"style": "plain",
"type": "time"
}
],
"type": "rprompt"
}
],
"console_title_template": "{{ .Shell }} in {{ .Folder }}",
"final_space": true,
"secondary_prompt": {
"background": "transparent",
"foreground": "p:black",
"template": "<p:yellow,transparent>\ue0b6</><,p:yellow> > </><p:yellow,transparent>\ue0b0</> "
},
"tooltips": [
{
"background": "p:orange",
"foreground": "p:white",
"leading_diamond": "\ue0b6",
"properties": {
"display_default": true,
"template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} "
},
"style": "diamond",
"tips": ["aws"],
"trailing_diamond": "\ue0b4",
"type": "aws"
},
{
"background": "p:blue",
"foreground": "p:white",
"leading_diamond": "\ue0b6",
"properties": {
"template": " \ufd03 {{ .Name }} "
},
"style": "diamond",
"tips": ["az"],
"trailing_diamond": "\ue0b4",
"type": "az"
}
],
"transient_prompt": {
"background": "transparent",
"foreground": "p:black",
"template": "<p:yellow,transparent>\ue0b6</><,p:yellow> {{ .Folder }} </><p:yellow,transparent>\ue0b0</> "
},
"version": 1
}