Skip to content

Commit 09255ae

Browse files
fix: use full block for spaces only with a background
This reverts commit 7d3629c. This resolves #212
1 parent 95c51a8 commit 09255ae

20 files changed

+32
-146
lines changed

docs/docs/configuration.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,10 @@ You can use these on any segment, the engine is responsible for adding them corr
182182
##### Prefix
183183

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

187186
##### Postfix
188187

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

192190
##### Ignore Folders
193191

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

203201
#### Colors
204202

205-
You have the ability to override the foreground and/or background color for text in any property that accepts it.
206-
The syntax is custom but should be rather straighforward:
207-
`<#ffffff,#000000>this is white with black background</> <#FF479C>but this is pink</>`.
208-
Anything between the color start `<#FF479C>` and end `</>` will be colored accordingly.
203+
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
204+
should be rather straighforward: `<#ffffff,#000000>this is white with black background</> <#FF479C>but this is pink</>`. Anything between the color start
205+
`<#FF479C>` and end `</>` will be colored accordingly.
209206

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

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

231-
- Typical [hex colors][hexcolors] (for example `#CB4B16`).
232-
- The `transparent` keyword which can be used to create either a transparent foreground override
229+
* The `transparent` keyword which can be used to create either a transparent foreground override
233230
or transparent background color using the segement's foreground property.
234-
- 16 [ANSI color names][ansicolors].
231+
232+
* 16 [ANSI color names][ansicolors].
235233

236234
These include 8 basic ANSI colors and `default`:
237235

@@ -256,7 +254,6 @@ Oh my Posh mainly supports three different color types being
256254
"type": "time",
257255
"style": "plain",
258256
"foreground": "#007ACC",
259-
"background": "transparent",
260257
"properties": {
261258
"time_format": "15:04:05"
262259
}

engine.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ func (e *engine) renderDiamondSegment(text string) {
6464
}
6565

6666
func (e *engine) renderText(text string) {
67-
defaultValue := fmt.Sprintf("<%s>\u2588</>", e.activeSegment.Background)
67+
defaultValue := " "
68+
if e.activeSegment.Background != "" {
69+
defaultValue = fmt.Sprintf("<%s>\u2588</>", e.activeSegment.Background)
70+
}
6871
prefix := e.activeSegment.getValue(Prefix, defaultValue)
6972
postfix := e.activeSegment.getValue(Postfix, defaultValue)
7073
e.renderer.write(e.activeSegment.Background, e.activeSegment.Foreground, fmt.Sprintf("%s%s%s", prefix, text, postfix))

themes/agnosterplus.omp.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"type": "time",
1010
"style": "plain",
1111
"foreground": "#007ACC",
12-
"background": "transparent",
1312
"properties": {
1413
"time_format": "15:04:05"
1514
}

themes/avit.omp.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"type": "path",
99
"style": "plain",
1010
"foreground": "#ffffff",
11-
"background": "transparent",
1211
"properties": {
1312
"prefix": "",
1413
"style": "short"
@@ -17,23 +16,17 @@
1716
{
1817
"type": "git",
1918
"style": "plain",
20-
"foreground": "#C2C206",
21-
"background": "transparent",
22-
"properties": {
23-
"prefix": ""
24-
}
19+
"foreground": "#C2C206"
2520
},
2621
{
2722
"type": "root",
2823
"style": "plain",
29-
"foreground": "#B5B50D",
30-
"background": "transparent"
24+
"foreground": "#B5B50D"
3125
},
3226
{
3327
"type": "exit",
3428
"style": "plain",
3529
"foreground": "#C94A16",
36-
"background": "transparent",
3730
"properties": {
3831
"prefix": "x"
3932
}
@@ -51,10 +44,8 @@
5144
"type": "text",
5245
"style": "plain",
5346
"foreground": "#007ACC",
54-
"background": "transparent",
5547
"properties": {
5648
"prefix": "",
57-
"postfix": "",
5849
"text": "\uE602"
5950
}
6051
}

themes/darkblood.omp.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"type": "session",
99
"style": "plain",
1010
"foreground": "#ffffff",
11-
"background": "transparent",
1211
"properties": {
1312
"user_info_separator": "",
1413
"display_host": false,
@@ -20,7 +19,6 @@
2019
"type": "git",
2120
"style": "plain",
2221
"foreground": "#ffffff",
23-
"background": "transparent",
2422
"properties": {
2523
"prefix": "<#CB4B16>[</>",
2624
"postfix": "<#CB4B16>]</>"
@@ -30,7 +28,6 @@
3028
"type": "root",
3129
"style": "plain",
3230
"foreground": "#ffffff",
33-
"background": "transparent",
3431
"properties": {
3532
"prefix": "<#CB4B16>[</>",
3633
"postfix": "<#CB4B16>]</>"
@@ -40,7 +37,6 @@
4037
"type": "exit",
4138
"style": "plain",
4239
"foreground": "#ffffff",
43-
"background": "transparent",
4440
"properties": {
4541
"prefix": "<#CB4B16>[x</>",
4642
"postfix": "<#CB4B16>]</>"
@@ -59,7 +55,6 @@
5955
"type": "path",
6056
"style": "plain",
6157
"foreground": "#ffffff",
62-
"background": "transparent",
6358
"properties": {
6459
"style": "short",
6560
"prefix": "<#CB4B16>┖[</>",

themes/emodipt.omp.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"type": "time",
99
"style": "plain",
1010
"foreground": "#E5C07B",
11-
"background": "transparent",
1211
"properties": {
1312
"time_format": "15:04:05",
1413
"prefix": "[",
@@ -18,14 +17,12 @@
1817
{
1918
"type": "root",
2019
"style": "plain",
21-
"foreground": "#B5B50D",
22-
"background": "transparent"
20+
"foreground": "#B5B50D"
2321
},
2422
{
2523
"type": "path",
2624
"style": "plain",
2725
"foreground": "#61AFEF",
28-
"background": "transparent",
2926
"properties": {
3027
"style": "agnoster",
3128
"postfix": " on"
@@ -35,7 +32,6 @@
3532
"type": "git",
3633
"style": "plain",
3734
"foreground": "#F3C267",
38-
"background": "transparent",
3935
"properties": {
4036
"display_status": true,
4137
"branch_identical_icon": "\uF14A",
@@ -46,7 +42,6 @@
4642
"type": "exit",
4743
"style": "plain",
4844
"foreground": "#C94A16",
49-
"background": "transparent",
5045
"properties": {
5146
"prefix": "x"
5247
}
@@ -55,14 +50,13 @@
5550
"type": "text",
5651
"style": "plain",
5752
"foreground": "#E06C75",
58-
"background": "transparent",
5953
"properties": {
6054
"prefix": "",
61-
"text": "\u276F"
55+
"text": " \u276F"
6256
}
6357
}
6458
]
6559
}
6660
],
67-
"final_space": false
61+
"final_space": true
6862
}

themes/fish.omp.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@
88
"type": "exit",
99
"style": "plain",
1010
"foreground": "#ffffff",
11-
"background": "transparent",
1211
"properties": {
1312
"postfix": ""
1413
}
1514
},
1615
{
1716
"type": "root",
1817
"style": "plain",
19-
"foreground": "#100e23",
20-
"background": "transparent"
18+
"foreground": "#100e23"
2119
},
2220
{
2321
"type": "session",
2422
"style": "plain",
25-
"foreground": "#ffffff",
26-
"background": "transparent"
23+
"foreground": "#ffffff"
2724
},
2825
{
2926
"type": "path",
@@ -52,7 +49,6 @@
5249
"type": "text",
5350
"style": "plain",
5451
"foreground": "#007ACC",
55-
"background": "transparent",
5652
"properties": {
5753
"prefix": "",
5854
"text": "\uE0B0"

themes/honukai.omp.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"type": "session",
99
"style": "plain",
1010
"foreground": "#FFFFFF",
11-
"background": "transparent",
1211
"properties": {
1312
"user_info_separator": " <#ffffff>in</> ",
1413
"prefix": "<#0377C8># </>",
@@ -20,7 +19,6 @@
2019
"type": "path",
2120
"style": "plain",
2221
"foreground": "#0973C0",
23-
"background": "transparent",
2422
"properties": {
2523
"folder_icon": "\uF115",
2624
"folder_separator_icon": "\uE0B1",
@@ -31,7 +29,6 @@
3129
"type": "git",
3230
"style": "plain",
3331
"foreground": "#B8B80A",
34-
"background": "transparent",
3532
"properties": {
3633
"prefix": "<#ffffff>on git:</>"
3734
}
@@ -46,7 +43,6 @@
4643
"type": "time",
4744
"style": "plain",
4845
"foreground": "#ffffff",
49-
"background": "transparent",
5046
"properties": {
5147
"prefix": "[",
5248
"postfix": "]"
@@ -65,7 +61,6 @@
6561
"type": "root",
6662
"style": "plain",
6763
"foreground": "#CECE04",
68-
"background": "transparent",
6964
"properties": {
7065
"prefix": ""
7166
}
@@ -74,22 +69,19 @@
7469
"type": "python",
7570
"style": "plain",
7671
"foreground": "#100e23",
77-
"background": "transparent",
7872
"properties": {
7973
"prefix": " \uE235 "
8074
}
8175
},
8276
{
8377
"type": "exit",
8478
"style": "plain",
85-
"foreground": "#CB4B16",
86-
"background": "transparent"
79+
"foreground": "#CB4B16"
8780
},
8881
{
8982
"type": "text",
9083
"style": "plain",
9184
"foreground": "#CC4B16",
92-
"background": "transparent",
9385
"properties": {
9486
"prefix": "",
9587
"text": "\u279C"
@@ -98,5 +90,5 @@
9890
]
9991
}
10092
],
101-
"final_space": false
93+
"final_space": true
10294
}

themes/lambda.omp.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"type": "text",
99
"style": "plain",
1010
"foreground": "#F5F5F5",
11-
"background": "transparent",
1211
"properties": {
1312
"prefix": "",
1413
"text": "\uFB26"
@@ -18,23 +17,20 @@
1817
"type": "path",
1918
"style": "plain",
2019
"foreground": "#B80101",
21-
"background": "transparent",
2220
"properties": {
23-
"prefix": "",
2421
"style": "agnoster"
2522
}
2623
},
2724
{
2825
"type": "git",
2926
"style": "plain",
3027
"foreground": "#B80101",
31-
"background": "transparent",
3228
"properties": {
3329
"prefix": " <#F5F5F5>git:</>"
3430
}
3531
}
3632
]
3733
}
3834
],
39-
"final_space": false
35+
"final_space": true
4036
}

themes/material.omp.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"type": "text",
99
"style": "plain",
1010
"foreground": "#ffffff",
11-
"background": "transparent",
1211
"properties": {
1312
"prefix": "",
1413
"text": "<#C591E8>\u276F</><#69FF94>\u276F</>"
@@ -18,17 +17,14 @@
1817
"type": "path",
1918
"style": "plain",
2019
"foreground": "#56B6C2",
21-
"background": "transparent",
2220
"properties": {
23-
"prefix": "",
2421
"style": "folder"
2522
}
2623
},
2724
{
2825
"type": "git",
2926
"style": "plain",
3027
"foreground": "#D0666F",
31-
"background": "transparent",
3228
"properties": {
3329
"branch_icon": "",
3430
"display_status": false,
@@ -40,7 +36,6 @@
4036
"type": "exit",
4137
"style": "plain",
4238
"foreground": "#DCB977",
43-
"background": "transparent",
4439
"properties": {
4540
"prefix": "\uD00D",
4641
"display_exit_code": false
@@ -50,13 +45,12 @@
5045
"type": "time",
5146
"style": "plain",
5247
"foreground": "#66F68F",
53-
"background": "transparent",
5448
"properties": {
5549
"time_format": "15:04"
5650
}
5751
}
5852
]
5953
}
6054
],
61-
"final_space": false
55+
"final_space": true
6256
}

0 commit comments

Comments
 (0)