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

未关闭
#4,230 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go, lua
领域
cli

调研方向

首先阅读 GetColor 附近当前的配色方案处理,以及使用 tcell 的终端渲染路径。研究 Micro 如何设置 truecolor 终端背景、检测或处理不受支持的终端,并在退出 Micro 时恢复颜色。完成的标准是终端边框与当前活动的普通背景一致,并在退出时恢复原始终端颜色。

由索引模型根据 Issue 内容生成。

描述

feature
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 #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.

主要语言
Go
星标
29.9k
派生
1.4k
平均合并
1 天 9 小时
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

micro-editor/micro 的其他 Issue

查看 micro-editor/micro 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。