Skip to content

Implement way to automatically detect dark/light terminal #150

@cmer

Description

@cmer

I'd like to propose the following:

If MCFLY_LIGHT is set to TRUE or FALSE, force McFly to display in the specified mode.

If MCFLY_LIGHT is NOT set, make a best effort guess to determine which mode to display in, otherwise fall back to dark mode. I was able to detect light/dark mode in some terminals (but not all) with the following Fish script:

  if string match -r '\;15$' $COLORFGBG &> /dev/null
    set -gx MCFLY_LIGHT TRUE
  end

It'd be awesome if McFly could perform this check every time it is triggered when MCFLY_LIGHT is not set to any particular value.

The COLORFGBG environment variable is set by many terminals such as iTerm2, Rxvt and Konsole. macOS Terminal does NOT set it, however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions