Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git segment color properties have no effect #161

Closed
2 tasks done
turtlebasket opened this issue Nov 15, 2020 · 9 comments
Closed
2 tasks done

Git segment color properties have no effect #161

turtlebasket opened this issue Nov 15, 2020 · 9 comments

Comments

@turtlebasket
Copy link

turtlebasket commented Nov 15, 2020

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • 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.

@JanDeDobbeleer
Copy link
Owner

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.

JanDeDobbeleer added a commit that referenced this issue Nov 15, 2020
@turtlebasket
Copy link
Author

turtlebasket commented Nov 15, 2020

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.

@JanDeDobbeleer
Copy link
Owner

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.

@turtlebasket
Copy link
Author

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

@JanDeDobbeleer
Copy link
Owner

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.

@JanDeDobbeleer
Copy link
Owner

@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).

@turtlebasket
Copy link
Author

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

@albertmoravec
Copy link

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 😅.

@JanDeDobbeleer
Copy link
Owner

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants