Skip to content

Gruvbox & zt_light themes don't work with pygments 2.16.x #1431

@laomuon

Description

@laomuon

Description

When I launch with the option -t gruvbox or -t gruvbox_light, I encountered this error:

Possible theme error: Unrecognised color specification 'bold italic' in foreground ('bold italic').

Im on the main branch of the repo

Logs

Traceback (most recent call last):
  File "/home/muon/zulip-terminal/zulipterminal/cli/run.py", line 559, in main
    Controller(
  File "/home/muon/zulip-terminal/zulipterminal/core.py", line 99, in __init__
    self.loop = urwid.MainLoop(self.view, self.theme, screen=screen)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/muon/zulip-terminal/zl-env/lib/python3.11/site-packages/urwid/main_loop.py", line 118, in __init__
    screen.register_palette(palette)
  File "/home/muon/zulip-terminal/zl-env/lib/python3.11/site-packages/urwid/display_common.py", line 856, in register_palette
    self.register_palette_entry(*item)
  File "/home/muon/zulip-terminal/zl-env/lib/python3.11/site-packages/urwid/display_common.py", line 938, in register_palette_entry
    high_256 = AttrSpec(foreground_high, background_high, 256)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/muon/zulip-terminal/zl-env/lib/python3.11/site-packages/urwid/display_common.py", line 537, in __init__
    self.foreground = fg
    ^^^^^^^^^^^^^^^
  File "/home/muon/zulip-terminal/zl-env/lib/python3.11/site-packages/urwid/display_common.py", line 637, in _set_foreground
    raise AttrSpecError(("Unrecognised color specification %s " +
urwid.display_common.AttrSpecError: Unrecognised color specification 'bold italic' in foreground ('bold italic')

Additional context

It seems that pygment:ges has a property bold italic which I think is not directly supported by urwid. A possible workaround:

--- a/zulipterminal/themes/gruvbox_dark.py
+++ b/zulipterminal/themes/gruvbox_dark.py
@@ -93,6 +93,7 @@ META = {
             'n'   : '#bdae93',             # gruvbox: light4
             'p'   : '#bdae93',             # gruvbox: light4
             'w'   : '#bdae93',             # gruvbox: light4
+            'ges'   : '#bdae93, bold, italics',             # gruvbox: light4
         }
     }
 }
diff --git a/zulipterminal/themes/gruvbox_light.py b/zulipterminal/themes/gruvbox_light.py
index e477a9f..dd2c6e4 100644
--- a/zulipterminal/themes/gruvbox_light.py
+++ b/zulipterminal/themes/gruvbox_light.py
@@ -92,6 +92,7 @@ META = {
             'n'   : '#93A1A1',             # gruvbox: light4
             'p'   : '#93A1A1',             # gruvbox: light4
             'w'   : '#93A1A1',             # gruvbox: light4
+            'ges'   : '#bdae93, bold, italics',             # gruvbox: light4
         }
     }
 }

Im not sure however of the color choice. Any thought?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions