Skip to content

Commit

Permalink
fix: use full block for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Dec 2, 2020
1 parent c73d197 commit 7d3629c
Show file tree
Hide file tree
Showing 20 changed files with 148 additions and 30 deletions.
17 changes: 10 additions & 7 deletions docs/docs/configuration.md
Expand Up @@ -182,10 +182,12 @@ You can use these on any segment, the engine is responsible for adding them corr
##### Prefix

The string content will be put in front of the segment's output text. Useful for symbols, text or other customizations.
Defaults to `<color>\u2588</>` where `color` is the background color of the segment.

##### Postfix

The string content will be put after the segment's output text. Useful for symbols, text or other customizations.
Defaults to `<color>\u2588</>` where `color` is the background color of the segment.

##### Ignore Folders

Expand All @@ -200,9 +202,10 @@ segment's configuration will not render it when in that location. The engine wil

#### Colors

You have the ability to override the foreground and/or background color for text in any property that accepts it. The syntax is custom but
should be rather straighforward: `<#ffffff,#000000>this is white with black background</> <#FF479C>but this is pink</>`. Anything between the color start
`<#FF479C>` and end `</>` will be colored accordingly.
You have the ability to override the foreground and/or background color for text in any property that accepts it.
The syntax is custom but should be rather straighforward:
`<#ffffff,#000000>this is white with black background</> <#FF479C>but this is pink</>`.
Anything between the color start `<#FF479C>` and end `</>` will be colored accordingly.

For example, if you want `prefix` to print a colored bracket which isn't the same as the segment's `foreground`, you can
do so like this:
Expand All @@ -224,12 +227,11 @@ To change *only* the background color, just omit the first color from the above
```

Oh my Posh mainly supports three different color types being
* Typical [hex colors][hexcolors] (for example `#CB4B16`).

* The `transparent` keyword which can be used to create either a transparent foreground override
- Typical [hex colors][hexcolors] (for example `#CB4B16`).
- The `transparent` keyword which can be used to create either a transparent foreground override
or transparent background color using the segement's foreground property.

* 16 [ANSI color names][ansicolors].
- 16 [ANSI color names][ansicolors].

These include 8 basic ANSI colors and `default`:

Expand All @@ -254,6 +256,7 @@ Oh my Posh mainly supports three different color types being
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"time_format": "15:04:05"
}
Expand Down
5 changes: 3 additions & 2 deletions engine.go
Expand Up @@ -64,8 +64,9 @@ func (e *engine) renderDiamondSegment(text string) {
}

func (e *engine) renderText(text string) {
prefix := e.activeSegment.getValue(Prefix, " ")
postfix := e.activeSegment.getValue(Postfix, " ")
defaultValue := fmt.Sprintf("<%s>\u2588</>", e.activeSegment.Background)
prefix := e.activeSegment.getValue(Prefix, defaultValue)
postfix := e.activeSegment.getValue(Postfix, defaultValue)
e.renderer.write(e.activeSegment.Background, e.activeSegment.Foreground, fmt.Sprintf("%s%s%s", prefix, text, postfix))
if *e.env.getArgs().Debug {
e.renderer.write(e.activeSegment.Background, e.activeSegment.Foreground, fmt.Sprintf("(%s:%s)", e.activeSegment.Type, e.activeSegment.timing))
Expand Down
1 change: 1 addition & 0 deletions themes/agnosterplus.omp.json
Expand Up @@ -9,6 +9,7 @@
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"time_format": "15:04:05"
}
Expand Down
13 changes: 11 additions & 2 deletions themes/avit.omp.json
Expand Up @@ -8,6 +8,7 @@
"type": "path",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"style": "short"
Expand All @@ -16,17 +17,23 @@
{
"type": "git",
"style": "plain",
"foreground": "#C2C206"
"foreground": "#C2C206",
"background": "transparent",
"properties": {
"prefix": ""
}
},
{
"type": "root",
"style": "plain",
"foreground": "#B5B50D"
"foreground": "#B5B50D",
"background": "transparent"
},
{
"type": "exit",
"style": "plain",
"foreground": "#C94A16",
"background": "transparent",
"properties": {
"prefix": "x"
}
Expand All @@ -44,8 +51,10 @@
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"prefix": "",
"postfix": "",
"text": "\uE602"
}
}
Expand Down
5 changes: 5 additions & 0 deletions themes/darkblood.omp.json
Expand Up @@ -8,6 +8,7 @@
"type": "session",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"user_info_separator": "",
"display_host": false,
Expand All @@ -19,6 +20,7 @@
"type": "git",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "<#CB4B16>[</>",
"postfix": "<#CB4B16>]</>"
Expand All @@ -28,6 +30,7 @@
"type": "root",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "<#CB4B16>[</>",
"postfix": "<#CB4B16>]</>"
Expand All @@ -37,6 +40,7 @@
"type": "exit",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "<#CB4B16>[x</>",
"postfix": "<#CB4B16>]</>"
Expand All @@ -55,6 +59,7 @@
"type": "path",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"style": "short",
"prefix": "<#CB4B16>┖[</>",
Expand Down
12 changes: 9 additions & 3 deletions themes/emodipt.omp.json
Expand Up @@ -8,6 +8,7 @@
"type": "time",
"style": "plain",
"foreground": "#E5C07B",
"background": "transparent",
"properties": {
"time_format": "15:04:05",
"prefix": "[",
Expand All @@ -17,12 +18,14 @@
{
"type": "root",
"style": "plain",
"foreground": "#B5B50D"
"foreground": "#B5B50D",
"background": "transparent"
},
{
"type": "path",
"style": "plain",
"foreground": "#61AFEF",
"background": "transparent",
"properties": {
"style": "agnoster",
"postfix": " on"
Expand All @@ -32,6 +35,7 @@
"type": "git",
"style": "plain",
"foreground": "#F3C267",
"background": "transparent",
"properties": {
"display_status": true,
"branch_identical_icon": "\uF14A",
Expand All @@ -42,6 +46,7 @@
"type": "exit",
"style": "plain",
"foreground": "#C94A16",
"background": "transparent",
"properties": {
"prefix": "x"
}
Expand All @@ -50,13 +55,14 @@
"type": "text",
"style": "plain",
"foreground": "#E06C75",
"background": "transparent",
"properties": {
"prefix": "",
"text": " \u276F"
"text": "\u276F"
}
}
]
}
],
"final_space": true
"final_space": false
}
8 changes: 6 additions & 2 deletions themes/fish.omp.json
Expand Up @@ -8,19 +8,22 @@
"type": "exit",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"postfix": ""
}
},
{
"type": "root",
"style": "plain",
"foreground": "#100e23"
"foreground": "#100e23",
"background": "transparent"
},
{
"type": "session",
"style": "plain",
"foreground": "#ffffff"
"foreground": "#ffffff",
"background": "transparent"
},
{
"type": "path",
Expand Down Expand Up @@ -49,6 +52,7 @@
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\uE0B0"
Expand Down
12 changes: 10 additions & 2 deletions themes/honukai.omp.json
Expand Up @@ -8,6 +8,7 @@
"type": "session",
"style": "plain",
"foreground": "#FFFFFF",
"background": "transparent",
"properties": {
"user_info_separator": " <#ffffff>in</> ",
"prefix": "<#0377C8># </>",
Expand All @@ -19,6 +20,7 @@
"type": "path",
"style": "plain",
"foreground": "#0973C0",
"background": "transparent",
"properties": {
"folder_icon": "\uF115",
"folder_separator_icon": "\uE0B1",
Expand All @@ -29,6 +31,7 @@
"type": "git",
"style": "plain",
"foreground": "#B8B80A",
"background": "transparent",
"properties": {
"prefix": "<#ffffff>on git:</>"
}
Expand All @@ -43,6 +46,7 @@
"type": "time",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "[",
"postfix": "]"
Expand All @@ -61,6 +65,7 @@
"type": "root",
"style": "plain",
"foreground": "#CECE04",
"background": "transparent",
"properties": {
"prefix": ""
}
Expand All @@ -69,19 +74,22 @@
"type": "python",
"style": "plain",
"foreground": "#100e23",
"background": "transparent",
"properties": {
"prefix": " \uE235 "
}
},
{
"type": "exit",
"style": "plain",
"foreground": "#CB4B16"
"foreground": "#CB4B16",
"background": "transparent"
},
{
"type": "text",
"style": "plain",
"foreground": "#CC4B16",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u279C"
Expand All @@ -90,5 +98,5 @@
]
}
],
"final_space": true
"final_space": false
}
6 changes: 5 additions & 1 deletion themes/lambda.omp.json
Expand Up @@ -8,6 +8,7 @@
"type": "text",
"style": "plain",
"foreground": "#F5F5F5",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\uFB26"
Expand All @@ -17,20 +18,23 @@
"type": "path",
"style": "plain",
"foreground": "#B80101",
"background": "transparent",
"properties": {
"prefix": "",
"style": "agnoster"
}
},
{
"type": "git",
"style": "plain",
"foreground": "#B80101",
"background": "transparent",
"properties": {
"prefix": " <#F5F5F5>git:</>"
}
}
]
}
],
"final_space": true
"final_space": false
}
8 changes: 7 additions & 1 deletion themes/material.omp.json
Expand Up @@ -8,6 +8,7 @@
"type": "text",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"text": "<#C591E8>\u276F</><#69FF94>\u276F</>"
Expand All @@ -17,14 +18,17 @@
"type": "path",
"style": "plain",
"foreground": "#56B6C2",
"background": "transparent",
"properties": {
"prefix": "",
"style": "folder"
}
},
{
"type": "git",
"style": "plain",
"foreground": "#D0666F",
"background": "transparent",
"properties": {
"branch_icon": "",
"display_status": false,
Expand All @@ -36,6 +40,7 @@
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"background": "transparent",
"properties": {
"prefix": "\uD00D",
"display_exit_code": false
Expand All @@ -45,12 +50,13 @@
"type": "time",
"style": "plain",
"foreground": "#66F68F",
"background": "transparent",
"properties": {
"time_format": "15:04"
}
}
]
}
],
"final_space": true
"final_space": false
}

0 comments on commit 7d3629c

Please sign in to comment.