【问题标题】:colour scheme for gnu source-highlight with a dark backgroundgnu source-highlight 的配色方案与深色背景
【发布时间】:2012-10-22 01:39:00
【问题描述】:

我使用的 gnu source-highlight 主要是较少的(所以它使用 ANSII 终端代码来制作颜色)。但是,由于背景颜色较深,突出显示的部分很暗,难以阅读。

有没有一种简单的方法来告诉 source-highlight 使用更适合深色背景的配色方案(例如,可以使用 vim)?

【问题讨论】:

  • 我怀疑有可能设置LESSOPEN 来通过vim 荧光笔传递内容..
  • 看来vim可以像less一样使用:superuser.com/a/168284/101005
  • 对我来说最好的选择是using pygmentize
  • 我把它放在一个 bash 初始化文件 pygless() { LESSOPEN="| pygmentize -f terminal256 -O style=native -g %s" less "$@" } 中,现在我使用 pygless 来读取代码 :)
  • 不错的@ricab。不得不稍微改变一下:pygless() { LESSOPEN="| pygmentize -f terminal256 -O style=native -g %s"; less "$@"; }(注意分号)。让它成为一个答案,我会接受它(:

标签: colors gnu color-scheme source-highlighting


【解决方案1】:

我不知道如何使用 source-highlight 来做到这一点,所以我完全跳过了它,used pygmentize 也一样。为此,我创建了一个函数,当我想要代码突出显示时,我会使用而不是使用 less

pygless()
{
  LESSOPEN="| pygmentize -f terminal256 -O style=native -g %s" less -R "$@";
}

【讨论】:

  • (2019 年)pygmentize 不幸的是非常慢:⯈time pygmentize -f terminal256 -O style=native -g < /usr/include/linux/fs.h 0,39s 用户 0,03s 系统 99% cpu 0,428 总计 ⯈time source-highlight -i /usr/include/linux/fs.h -f esc256 0,03s 用户 0,00s 系统 98% cpu 0,037 总编辑:好的,所以评论格式仍然停留在 90 年代
猜你喜欢
  • 2018-12-25
  • 2021-12-30
  • 2011-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-03
  • 1970-01-01
相关资源
最近更新 更多