Oh-my-posh3: Git segment color properties have no effect

Created on 15 Nov 2020  Â·  9Comments  Â·  Source: JanDeDobbeleer/oh-my-posh3

Prerequisites

  • [x] I have read and understand the CONTRIBUTING guide
  • [x] I looked for duplicate issues before submitting this one

Description

My configuration for the git segment is as follows:

{
    "type": "git",
    "style": "powerline",
    "powerline_symbol": "î‚°",
    "invert_powerline": false,
    "foreground": "black",
    "background": "lightGreen",
    "leading_diamond": "",
    "trailing_diamond": "",
    "properties": {
        "display_stash_count": true,
        "display_upstream_icon": true,
    "color_background": true,
    "status_colors_enabled": true,
    "color_background": true,
    "working_color": "lightYellow",
    "local_changes": "lightYellow"
    }
},

When I change the color properties for "working_color", "local_changes", etc. and then enter a local git repo with changes, the prompt only shows the original color.
NOTE: The number of changed files does show in the git segment, and altering other properties like the branch icon still works, which is why I believe it's an issue with the git colors specifically.

(My config changes were based on reading the documentation. It's a bit sparse, but that's understandable, given how new and quickly-evolving this project is. If it turns out I'm just doing something seriously wrong here or missing something, perhaps the section about git segment colors could specify what else needs to be set beforehand.)

Environment

  • Oh my Posh version: 3.35.0 beta
  • Theme: Custom (see git segment config above)

  • Operating System: Windows 10 Enterprise

  • Shell: Powershell 7.1
  • Terminal: Windows Terminal

Steps to Reproduce

  1. Copy git segment config above into a custom config.
  2. Start a new pwsh/powershell instance and enter a local git repo with changed files.

Expected behavior: Upon setting status_colors_enabled to true and changing working_color and local_changes to lightYellow, the git status color should change to lightYellow when inside a git repo with changed files.

Actual behavior: Upon setting status_colors_enabled to true and changing working_color and local_changes to lightYellow, the git status color does not change to lightYellow when inside a git repo with changed files.

Most helpful comment

I think this is because that doesn't support the non hex colors yet. Let me check. If you change this to a hex color, does it show the color? I have this working on the latest version.

All 9 comments

I think this is because that doesn't support the non hex colors yet. Let me check. If you change this to a hex color, does it show the color? I have this working on the latest version.

I've tried changing my config to:

{
    "type": "git",
    "style": "powerline",
    "powerline_symbol": "î‚°",
    "invert_powerline": false,
    "foreground": "black",
    "background": "lightGreen",
    "leading_diamond": "",
    "trailing_diamond": "",
    "properties": {
        "display_stash_count": true,
        "display_upstream_icon": true,
        "color_background": true,
        "status_colors_enabled": true,
        "working_color": "#f0f0f0",
        "local_changes": "#f0f0f0"
    }
},

Looks like hex colors did something!
Not the effect I was expecting (changes text color, not the color for the segment background). I guess this issue thread could also serve as a feature request to add an option for specifying whether the text or the background changes color?

Edit: If what I just described is something that the "color_background" property is meant to do, I guess it could possibly be an issue with that as well.

That's exactly what it does and does so on my setups, also with the 16 colors. I'll check if I misread something in the thread when I have more time.

Sure! Just to clarify, the background color behavior I'm looking for in the git segment is based on what the powerlevel10k zsh theme does with git repos:

image
image

Yes, that's exactly what this does :-)

image

With this config on 3.36.1:

{
  "type": "git",
  "style": "powerline",
  "powerline_symbol": "î‚°",
  "foreground": "black",
  "background": "lightGreen",
  "properties": {
    "display_stash_count": true,
    "display_upstream_icon": true,
    "status_colors_enabled": true,
    "color_background": true,
    "local_changes_color": "lightBlue",
    "ahead_and_behind_color": "#f26d50",
    "behind_color": "#f17c37",
    "ahead_color": "#89d1dc",
    "stash_count_icon": "\uF692 "
  }
}

So as far as I can see this work according to design.

@turtlebasket it does not work because you set a color to local_changes which should be local_changes_color.
Also, working_color colors the +2 ~1 working area detail string (foreground).

Oh, my bad. Besides support for non-hex colors (which you've already added), I think that covers it, then!

Thanks for clarifying this, I spent like half an hour trying to figure out how it works, because it's not 100% clear what color are the parameters affecting (foreground/background - I didn't get that it's affected by color_background) and another hour trying to make ANSI colors work 😅.

Thanks for clarifying this, I spent like half an hour trying to figure out how it works, because it's not 100% clear what color are the parameters affecting (foreground/background - I didn't get that it's affected by color_background) and another hour trying to make ANSI colors work 😅.

I'll rewrite the docs, this information is very valuable as I write from my perspective (which is biased).

Was this page helpful?
0 / 5 - 0 ratings