Skip to content

log -- configure colors per log level #944

@reitzig

Description

@reitzig

Is your feature request related to a problem? Please describe.

I would like to adapt the output of gum log to the shell color theme that I use (shoutout to catppuccin) so that all levels have clear contrast over the background and are comfortable to read. The defaults are, at least to my eyes, not ideal:

Image

While I can set GUM_LOG_LEVEL_FOREGROUND, that changes the color for all levels:

Image

While it's conceivable to do this in an application or elaborate scripts that wrap logging, it's not useful as a user-level setting, which I need to adapt to my local shell theme.

Describe the solution you'd like

Split GUM_LOG_LEVEL_FOREGROUND and GUM_LOG_LEVEL_BACKGROUND into separate environment variables for each log level, e.g. GUM_LOG_LEVEL_DEBUG_FOREGROUND.

Describe alternatives you've considered

  • In the script(s) using gum, use the existing variables to forward user-level setting to gum log, with reasonable defaults.
    👎️ Having to change all scripts that use gum log seems like unnecessary overhead, and artificial complexity for all users of shared scripts that do not want to customize colors.
  • Introduce the concept of themes / color palettes to gum overall, as opposed to re-configuring each element of each command individually.
    🤷 Seems like a good idea to me, but that's probably be a major piece of work, including refactoring of all commands.
  • gum could transparently use the color palette of the terminal/shell as default, and be compatible by definition.
    🤔 While probably the ideal outcome for most users, this is probably a can of worms.

Additional context

  • From the documentation and help output of gum, I find it hard to determine which values to assign to style variables. Maybe it's very clear if you're familiar with lipgloss; as a "naive" user of gum to spice up shell scripts, it isn't.
  • A side note: While setting a bunch of environment variables in a user-level "config" file (think dotfiles) is feasible, the lack of a proper config file for gum is noticeable. If there are no strong reasons against having one, it may be something to consider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions