JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.38k stars 2.38k forks source link

`ahead_color` in `git` segment has no effect #1080

Closed bozho closed 3 years ago

bozho commented 3 years ago

Code of Conduct

What happened?

ahead_color segment setting seems to have no effect. When my branch is ahead (there are thing to push to remote), git segment colour is the one set in foreground. I've tried both colour names and hex codes.

behind_color works fine, haven't had a chance to test ahead_and_behind_color yet.

Version

oh-my-posh PS module v5.8.0 in PowerShell 5.1 and 7.2.0-preview.7, on Windows 10 Pro,

Theme

Here's my git segment config:

        {
          "type": "git",
          "style": "plain",
          "foreground": "#1cb3e0",
          "properties": {
            "prefix": "<#ffffff> [</>",
            "postfix": "<#ffffff>]</>",
            "display_status": true,
            "display_branch_status": true,
            "display_status_detail": true,
            "display_stash_count": true,
            "display_worktree_count": false,
            "display_upstream_icon": true,
            "branch_max_length": 0,
            "status_colors_enabled": true,
            "color_background": false,
            "ahead_and_behind_color": "lightYellow",
            "behind_color": "lightRed",
            "ahead_color": "lightGreen",
            "working_color": "lightRed",
            "staging_color": "green"
          }
        }

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Relevant log output

No response

lnu commented 3 years ago

Strange. Works here: image

with:

          "background": "#fffb38",
          "foreground": "#193549",
          "powerline_symbol": "",
          "properties": {
            "ahead_and_behind_color": "#f26d50",
            "ahead_color": "#a3dc89",
            "behind_color": "#f17c37",
            "local_changes_color": "#f567fa",
            "display_stash_count": true,
            "display_upstream_icon": true,
            "stash_count_icon": " ",
            "status_colors_enabled": true,
            "display_status": true,
            "branch_max_length": 255,
            "display_worktree_count": true
          },
          "style": "powerline",
          "type": "git"

I also tried you config and the colors are fine(green when ahead):` image

bozho commented 3 years ago

Ah, it looks like ahead_color is not honoured when the branch is ahead and there are local changes:

image

Is that by design?

bozho commented 3 years ago

Ah, there's local_ changes_color, too, which I didn't set, so it defaults to the segment colour.

I'm just used to posh-git prompt, where branch colours are separate from local working tree colours :)

lnu commented 3 years ago

you can still use posh git => https://ohmyposh.dev/docs/poshgit

bozho commented 3 years ago

I know, I just wanted to be cool with icons and stuff :)

Thank you, closing.

SharakPL commented 3 years ago

So is there any way to set the color for ahead/behind in git segment? That's my config:

obraz

Colors for staging and working are correct:

obraz

but ahead (I suspect it's the same for behind) are not:

obraz

Tried setting up local_changes_color (changes background instead of foreground!) and ahead_and_behind_color but it doesn't seem to work. It should be reopned as it still needs fixing.

JanDeDobbeleer commented 3 years ago

You need to set "status_colors_enabled": true. Also, there's a change incoming for the git segment (#1163) that will render this deprecated and you can use (by then) the background_templates/foreground_templates logic to color the segment accordingly.

And yes, setting local_changes_color colors the background as there's also color_background that defaults to true.

SharakPL commented 3 years ago

Correction: local_changes_color doesn't change anything on its own and adding "status_colors_enabled": true changes background. Naming of properties seems quite complicated TBH. I would expect status_color_enabled to simply toggle color customization. false should make whole git segment rendered with default color ("foreground": "#1ffdf2" in my case).

JanDeDobbeleer commented 3 years ago

@SharakPL these will all go away (silent support, no active support) so that'll be fixed really, really soon. Follow the PR #1163 for more information ;-)

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.