Skip to content

Set the terminal's background colour to match the current colourscheme #4230

Description

@achadwick

Description

At present, Micro does not attempt to set the terminal background to match the current colorscheme's normal background colour. If the background colour that Micro uses is very different from the terminal's normal background colour, it can result in large and inconsistent gaps where the terminal's background is shown, and not the editor's. It would be prettier and more consistent if we could get those gaps to match Micro's own background.

Image

This screenshot is exaggerated for effect, and the right hand side is a mock-up of what I'm hoping we can have. The size and placement of the gaps depends on how your terminal emulator distributes extra whitespace, how much default border you configure in it, and also how well your window manager or compositor respects incremental sizing requests.

So the feature request is can we have a way to make those borders the same colour as the background colour used by Micro, when using a truecolor theme? There's more than one way to do it, I guess.

  • I was considering writing a plugin for it, after successfully making one for myself to set the xterm-style window title. Back when I was still using NeoVim, I used bg.nvim on a daily basis, and it mostly did a fair job. A plugin could do this job if it has access to the truecolor style info from the current colorscheme, the ability to add callbacks that fire after changing styles, and maybe a tty access layer (although, I just used io.write() to spray xterm codes back at the terminal for my title-setting thing!) Sadly, GetColor does not seem to be wrapped for Lua; something like it has been suggested in [Feature request] Tooltip support #3465 though.

  • I noticed that Helix editor does this by default, with its standard settings. Perhaps it is done as part of its low-level character cell styling routines? Micro's tcell might be the best place for this, then, and if it's implemented there, perhaps it should be made the default behaviour in Micro as a whole if it can be made reliable enough (the terminal needs to support it, but I'm not not sure how you'd determine that capability)?

The colour will need to be reset upon leaving Micro, however it's done.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions