gitui icon indicating copy to clipboard operation
gitui copied to clipboard

Loading theme, seems broken

Open Alt-iOS opened this issue 1 year ago • 4 comments

Describe the bug Gitui cant read theme.ron file on macos

To Reproduce Steps to reproduce the behavior: 1 Place the following on your theme.ron

(
    selected_tab: Some(Reset),
    command_fg: Some(Rgb(205, 214, 244)),
    selection_bg: Some(Rgb(88, 91, 112)),
    selection_fg: Some(Rgb(205, 214, 244)),
    cmdbar_bg: Some(Rgb(24, 24, 37)),
    cmdbar_extra_lines_bg: Some(Rgb(24, 24, 37)),
    disabled_fg: Some(Rgb(127, 132, 156)),
    diff_line_add: Some(Rgb(166, 227, 161)),
    diff_line_delete: Some(Rgb(243, 139, 168)),
    diff_file_added: Some(Rgb(249, 226, 175)),
    diff_file_removed: Some(Rgb(235, 160, 172)),
    diff_file_moved: Some(Rgb(203, 166, 247)),
    diff_file_modified: Some(Rgb(250, 179, 135)),
    commit_hash: Some(Rgb(180, 190, 254)),
    commit_time: Some(Rgb(186, 194, 222)),
    commit_author: Some(Rgb(116, 199, 236)),
    danger_fg: Some(Rgb(243, 139, 168)),
    push_gauge_bg: Some(Rgb(137, 180, 250)),
    push_gauge_fg: Some(Rgb(30, 30, 46)),
    tag_fg: Some(Rgb(245, 224, 220)),
    branch_fg: Some(Rgb(148, 226, 213))
)

Expected behavior The theme looks like the catpuccin mocha

Context (please complete the following information):

  • macos 14.4.1
  • gitui nightly 2024-05-18
  • rustc 1.78.0 (9b00956e5 2024-04-29)

Additional context The log file says the following .config/gitui/theme.ron"]: 2:24: Expected string

Alt-iOS avatar May 19 '24 20:05 Alt-iOS

Thats the version brew installs, but even when moving to stable and installing with cargo install, it will give the same error

Alt-iOS avatar May 19 '24 20:05 Alt-iOS

Going back to gitui 0.26.1 fixes the issue

Alt-iOS avatar May 19 '24 20:05 Alt-iOS

Also it seems that inside nvim it simply ignores the theme.ron file and uses whatever nvim theme is currently applied, Idk if this is a misconfig on my side tho, but as far as I understand, calling gitui inside nvim or directly in terminal shouldnt change the theme (no alias or nothing with -t option configured)

Alt-iOS avatar May 19 '24 21:05 Alt-iOS

I had the same problem so I went back to lazygit :)

kaidev0711 avatar May 20 '24 01:05 kaidev0711

some upstream crate changed the way Colors are serialized. thanks for reporting

extrawurst avatar May 20 '24 17:05 extrawurst

No problem! And thanks a lot for such great utility tool

Alt-iOS avatar May 20 '24 19:05 Alt-iOS

Unfortunately the Rgb notation for colors seems to have vanished from ratatui parsing colors, the way to achieve the same result now requires specifying colors in hex format #00ff00, sorry for the inconvenience. The upcoming PR #2243 will clarify this and 0.26.3 will mark this as a breaking change with a few examples

extrawurst avatar May 22 '24 09:05 extrawurst

Can you figure out how to set indexed colors now?

shagohead avatar May 24 '24 04:05 shagohead

yes, like this

(
    selected_tab: Some("Reset"),
    command_fg: Some("#4c4f69"),
    selection_bg: Some("#acb0be"),
    selection_fg: Some("#4c4f69"),
    cmdbar_bg: Some("#e6e9ef"),
    cmdbar_extra_lines_bg: Some("#e6e9ef"),
    disabled_fg: Some("#4c4f69"),
    diff_line_add: Some("#40a02b"),
    diff_line_delete: Some("#d20f39"),
    diff_file_added: Some("#df8e1d"),
    diff_file_removed: Some("#e64553"),
    diff_file_moved: Some("#8839ef"),
    diff_file_modified: Some("#fe640b"),
    commit_hash: Some("#7287fd"),
    commit_time: Some("#5c5f77"),
    commit_author: Some("#209fb5"),
    danger_fg: Some("#d20f39"),
    push_gauge_bg: Some("#1e66f5"),
    push_gauge_fg: Some("#eff1f5"),
    tag_fg: Some("#dc8a78"),
    branch_fg: Some("#179399")
)

Alt-iOS avatar May 24 '24 17:05 Alt-iOS

No, i mean indexed, which can be referenced by numbers from ANSI color table. It used to be like that: Indexed(18) (https://docs.rs/tui/0.12.0/tui/style/enum.Color.html)

shagohead avatar May 25 '24 07:05 shagohead

AH, no, sorry, try just putting "" around it, if it doesn't work, just use google to convert to rgb HEX, that's what worked for me

Alt-iOS avatar May 25 '24 12:05 Alt-iOS

AH, no, sorry, try just putting "" around it, if it doesn't work, just use google to convert to rgb HEX, that's what worked for me

Surrounding with quotes works. Thank you. It was silly not to try

shagohead avatar May 27 '24 18:05 shagohead