fix: use full block for spaces only with a background

This reverts commit 7d3629c7d4.
This resolves #212
This commit is contained in:
Jan De Dobbeleer 2020-12-02 18:40:10 +01:00 committed by Jan De Dobbeleer
parent 95c51a8538
commit 09255ae63d
20 changed files with 32 additions and 146 deletions

View file

@ -182,12 +182,10 @@ 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
@ -202,10 +200,9 @@ 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:
@ -227,11 +224,12 @@ 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`).
- Typical [hex colors][hexcolors] (for example `#CB4B16`).
- The `transparent` keyword which can be used to create either a transparent foreground override
* 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`:
@ -256,7 +254,6 @@ Oh my Posh mainly supports three different color types being
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"time_format": "15:04:05"
}

View file

@ -64,7 +64,10 @@ func (e *engine) renderDiamondSegment(text string) {
}
func (e *engine) renderText(text string) {
defaultValue := fmt.Sprintf("<%s>\u2588</>", e.activeSegment.Background)
defaultValue := " "
if e.activeSegment.Background != "" {
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))

View file

@ -9,7 +9,6 @@
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"time_format": "15:04:05"
}

View file

@ -8,7 +8,6 @@
"type": "path",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"style": "short"
@ -17,23 +16,17 @@
{
"type": "git",
"style": "plain",
"foreground": "#C2C206",
"background": "transparent",
"properties": {
"prefix": ""
}
"foreground": "#C2C206"
},
{
"type": "root",
"style": "plain",
"foreground": "#B5B50D",
"background": "transparent"
"foreground": "#B5B50D"
},
{
"type": "exit",
"style": "plain",
"foreground": "#C94A16",
"background": "transparent",
"properties": {
"prefix": "x"
}
@ -51,10 +44,8 @@
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"prefix": "",
"postfix": "",
"text": "\uE602"
}
}

View file

@ -8,7 +8,6 @@
"type": "session",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"user_info_separator": "",
"display_host": false,
@ -20,7 +19,6 @@
"type": "git",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "<#CB4B16>[</>",
"postfix": "<#CB4B16>]</>"
@ -30,7 +28,6 @@
"type": "root",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "<#CB4B16>[</>",
"postfix": "<#CB4B16>]</>"
@ -40,7 +37,6 @@
"type": "exit",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "<#CB4B16>[x</>",
"postfix": "<#CB4B16>]</>"
@ -59,7 +55,6 @@
"type": "path",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"style": "short",
"prefix": "<#CB4B16>┖[</>",

View file

@ -8,7 +8,6 @@
"type": "time",
"style": "plain",
"foreground": "#E5C07B",
"background": "transparent",
"properties": {
"time_format": "15:04:05",
"prefix": "[",
@ -18,14 +17,12 @@
{
"type": "root",
"style": "plain",
"foreground": "#B5B50D",
"background": "transparent"
"foreground": "#B5B50D"
},
{
"type": "path",
"style": "plain",
"foreground": "#61AFEF",
"background": "transparent",
"properties": {
"style": "agnoster",
"postfix": " on"
@ -35,7 +32,6 @@
"type": "git",
"style": "plain",
"foreground": "#F3C267",
"background": "transparent",
"properties": {
"display_status": true,
"branch_identical_icon": "\uF14A",
@ -46,7 +42,6 @@
"type": "exit",
"style": "plain",
"foreground": "#C94A16",
"background": "transparent",
"properties": {
"prefix": "x"
}
@ -55,14 +50,13 @@
"type": "text",
"style": "plain",
"foreground": "#E06C75",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u276F"
"text": " \u276F"
}
}
]
}
],
"final_space": false
"final_space": true
}

View file

@ -8,7 +8,6 @@
"type": "exit",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"postfix": ""
}
@ -16,14 +15,12 @@
{
"type": "root",
"style": "plain",
"foreground": "#100e23",
"background": "transparent"
"foreground": "#100e23"
},
{
"type": "session",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent"
"foreground": "#ffffff"
},
{
"type": "path",
@ -52,7 +49,6 @@
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\uE0B0"

View file

@ -8,7 +8,6 @@
"type": "session",
"style": "plain",
"foreground": "#FFFFFF",
"background": "transparent",
"properties": {
"user_info_separator": " <#ffffff>in</> ",
"prefix": "<#0377C8># </>",
@ -20,7 +19,6 @@
"type": "path",
"style": "plain",
"foreground": "#0973C0",
"background": "transparent",
"properties": {
"folder_icon": "\uF115",
"folder_separator_icon": "\uE0B1",
@ -31,7 +29,6 @@
"type": "git",
"style": "plain",
"foreground": "#B8B80A",
"background": "transparent",
"properties": {
"prefix": "<#ffffff>on git:</>"
}
@ -46,7 +43,6 @@
"type": "time",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "[",
"postfix": "]"
@ -65,7 +61,6 @@
"type": "root",
"style": "plain",
"foreground": "#CECE04",
"background": "transparent",
"properties": {
"prefix": ""
}
@ -74,7 +69,6 @@
"type": "python",
"style": "plain",
"foreground": "#100e23",
"background": "transparent",
"properties": {
"prefix": " \uE235 "
}
@ -82,14 +76,12 @@
{
"type": "exit",
"style": "plain",
"foreground": "#CB4B16",
"background": "transparent"
"foreground": "#CB4B16"
},
{
"type": "text",
"style": "plain",
"foreground": "#CC4B16",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u279C"
@ -98,5 +90,5 @@
]
}
],
"final_space": false
"final_space": true
}

View file

@ -8,7 +8,6 @@
"type": "text",
"style": "plain",
"foreground": "#F5F5F5",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\uFB26"
@ -18,9 +17,7 @@
"type": "path",
"style": "plain",
"foreground": "#B80101",
"background": "transparent",
"properties": {
"prefix": "",
"style": "agnoster"
}
},
@ -28,7 +25,6 @@
"type": "git",
"style": "plain",
"foreground": "#B80101",
"background": "transparent",
"properties": {
"prefix": " <#F5F5F5>git:</>"
}
@ -36,5 +32,5 @@
]
}
],
"final_space": false
"final_space": true
}

View file

@ -8,7 +8,6 @@
"type": "text",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"text": "<#C591E8>\u276F</><#69FF94>\u276F</>"
@ -18,9 +17,7 @@
"type": "path",
"style": "plain",
"foreground": "#56B6C2",
"background": "transparent",
"properties": {
"prefix": "",
"style": "folder"
}
},
@ -28,7 +25,6 @@
"type": "git",
"style": "plain",
"foreground": "#D0666F",
"background": "transparent",
"properties": {
"branch_icon": "",
"display_status": false,
@ -40,7 +36,6 @@
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"background": "transparent",
"properties": {
"prefix": "\uD00D",
"display_exit_code": false
@ -50,7 +45,6 @@
"type": "time",
"style": "plain",
"foreground": "#66F68F",
"background": "transparent",
"properties": {
"time_format": "15:04"
}
@ -58,5 +52,5 @@
]
}
],
"final_space": false
"final_space": true
}

View file

@ -70,7 +70,6 @@
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u276F"

View file

@ -8,7 +8,6 @@
"type": "text",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"text": "<#C591E8>\u276F</><#69FF94>\u276F</>"
@ -18,9 +17,7 @@
"type": "path",
"style": "plain",
"foreground": "#56B6C2",
"background": "transparent",
"properties": {
"prefix": "",
"style": "folder"
}
},
@ -28,7 +25,6 @@
"type": "git",
"style": "plain",
"foreground": "#D0666F",
"background": "transparent",
"properties": {
"branch_icon": "",
"display_status": false,
@ -40,7 +36,6 @@
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"background": "transparent",
"properties": {
"prefix": "\uD00D",
"display_exit_code": false
@ -56,7 +51,6 @@
"type": "command",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"shell": "bash",
"command": "git log --pretty=format:%cr -1 || date +%H:%m:%S"
@ -75,14 +69,13 @@
"type": "text",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\uF441 "
"text": "\uF441"
}
}
]
}
],
"final_space": false
"final_space": true
}

View file

@ -88,7 +88,6 @@
"type": "exit",
"style": "plain",
"foreground": "#D4E157",
"background": "transparent",
"properties": {
"prefix": "\u276F",
"always_enabled": true,

View file

@ -9,7 +9,6 @@
"type": "time",
"style": "plain",
"foreground": "#00C5C7",
"background": "transparent",
"properties": {
"time_format": "15:04:05"
}
@ -27,7 +26,6 @@
"type": "path",
"style": "plain",
"foreground": "#77E4F7",
"background": "transparent",
"properties": {
"prefix": "",
"style": "short"
@ -37,7 +35,6 @@
"type": "git",
"style": "plain",
"foreground": "#FFE700",
"background": "transparent",
"properties": {
"prefix": ""
}
@ -46,7 +43,6 @@
"type": "text",
"style": "plain",
"foreground": "#43D426",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u276F"

View file

@ -7,14 +7,12 @@
{
"type": "root",
"style": "plain",
"foreground": "#FFEE58",
"background": "transparent"
"foreground": "#FFEE58"
},
{
"type": "session",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent"
"foreground": "#ffffff"
},
{
"type": "path",

View file

@ -8,7 +8,6 @@
"type": "text",
"style": "plain",
"foreground": "#98C379",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u279C",
@ -19,7 +18,6 @@
"type": "path",
"style": "plain",
"foreground": "#56B6C2",
"background": "transparent",
"properties": {
"style": "folder"
}
@ -28,7 +26,6 @@
"type": "git",
"style": "plain",
"foreground": "#D0666F",
"background": "transparent",
"properties": {
"branch_icon": "",
"display_status": false,
@ -40,7 +37,6 @@
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"background": "transparent",
"properties": {
"prefix": "\uD00D",
"display_exit_code": false

View file

@ -7,31 +7,7 @@
"definitions": {
"color": {
"type": "string",
"oneOf": [
{ "pattern": "^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$" },
{
"enum": [
"black",
"red",
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white",
"default",
"darkGray",
"lightRed",
"lightGreen",
"lightYellow",
"lightBlue",
"lightMagenta",
"lightCyan",
"lightWhite",
"transparent"
]
}
],
"pattern": "^(#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})|black|red|green|yellow|blue|magenta|cyan|white|default|darkGray|lightRed|lightGreen|lightYellow|lightBlue|lightMagenta|lightCyan|lightWhite)$",
"title": "Color string",
"description": "https://ohmyposh.dev/docs/configure#colors"
},
@ -100,7 +76,7 @@
"title": "A segment",
"description": "https://ohmyposh.dev/docs/configure#segment",
"default": {},
"required": ["type", "style", "foreground", "background"],
"required": ["type", "style", "foreground"],
"properties": {
"type": {
"type": "string",

View file

@ -7,37 +7,23 @@
{
"type": "exit",
"style": "plain",
"foreground": "#CB4B16",
"background": "transparent",
"properties": {
"prefix": ""
}
"foreground": "#CB4B16"
},
{
"type": "root",
"style": "plain",
"foreground": "#CECE04",
"background": "transparent",
"properties": {
"prefix": ""
}
"foreground": "#CECE04"
},
{
"type": "session",
"style": "plain",
"foreground": "#FFFFFF",
"background": "transparent",
"properties": {
"prefix": ""
}
"foreground": "#FFFFFF"
},
{
"type": "path",
"style": "plain",
"foreground": "#0973C0",
"background": "transparent",
"properties": {
"prefix": "",
"style": "short"
}
},
@ -45,7 +31,6 @@
"type": "git",
"style": "plain",
"foreground": "#C1C106",
"background": "transparent",
"properties": {
"prefix": "<#ffffff>git:</>"
}
@ -54,7 +39,6 @@
"type": "python",
"style": "plain",
"foreground": "#100e23",
"background": "transparent",
"properties": {
"prefix": " \uE235 "
}
@ -63,7 +47,6 @@
"type": "text",
"style": "plain",
"foreground": "#ffffff",
"background": "transparent",
"properties": {
"prefix": "",
"text": "<#CB4B16>\u276F</><#CACA02>\u276F</><#4E9A06>\u276F</>"

View file

@ -8,7 +8,6 @@
"type": "root",
"style": "plain",
"foreground": "#E06C75",
"background": "transparent",
"properties": {
"root_icon": "root",
"prefix": "",
@ -19,7 +18,6 @@
"type": "path",
"style": "plain",
"foreground": "#55B9C4",
"background": "transparent",
"properties": {
"style": "folder",
"prefix": ""
@ -29,7 +27,6 @@
"type": "git",
"style": "plain",
"foreground": "#C678DD",
"background": "transparent",
"properties": {
"prefix": "<#ffffff>on</> ",
"display_status": true
@ -39,7 +36,6 @@
"type": "node",
"style": "plain",
"foreground": "#98C379",
"background": "transparent",
"properties": {
"display_version": true,
"prefix": "<#ffffff>via</> \uE781 "
@ -49,7 +45,6 @@
"type": "exit",
"style": "plain",
"foreground": "#C94A16",
"background": "transparent",
"properties": {
"prefix": "x",
"display_exit_code": false
@ -68,7 +63,6 @@
"type": "text",
"style": "plain",
"foreground": "#63F08C",
"background": "transparent",
"properties": {
"prefix": "",
"text": "\u279C"

View file

@ -8,7 +8,6 @@
"type": "session",
"style": "plain",
"foreground": "#E36464",
"background": "transparent",
"properties": {
"user_info_separator": "",
"display_host": false,
@ -19,7 +18,6 @@
"type": "text",
"style": "plain",
"foreground": "#62ED8B",
"background": "transparent",
"properties": {
"text": "\u279C",
"postfix": "",
@ -30,7 +28,6 @@
"type": "path",
"style": "plain",
"foreground": "#56B6C2",
"background": "transparent",
"properties": {
"style": "folder",
"postfix": ""
@ -40,19 +37,17 @@
"type": "git",
"style": "plain",
"foreground": "#D4AAFC",
"background": "transparent",
"properties": {
"branch_icon": "",
"display_status": false,
"prefix": " <#DDB15F>git(</>",
"postfix": "<#DDB15F>)</>"
"postfix": "<#DDB15F>)</>"
}
},
{
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"background": "transparent",
"properties": {
"prefix": "\uD00D",
"display_exit_code": false,