将 pygments 主题转换为 gvim colorcheme

发布于 2024-10-17 04:04:06 字数 297 浏览 6 评论 0原文

有没有任何工具可以将 pygments 样式定义转换为 gvim 颜色方案?

我找到了 vim2pygments,它将 vim colorchemes 转换为 pygments 主题,但我还没有发现任何相反的东西。具体来说,我使用的是 macvim,尽管我想象任何 gvim 衍生品的颜色方案格式都是相同的(如果我错了,请纠正我)。

Are there any tools to convert a pygments style definition into a gvim colorscheme?

I found vim2pygments, which converts vim colorschemes to pygments themes, but I haven't found anything doing the inverse. Specifically, I'm using macvim, though I imagine the colorscheme format would be the same for any gvim-derivative (please, correct me if I'm wrong).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一身仙ぐ女味 2024-10-24 04:04:06

我还没有遇到任何可以自动化这个过程的东西,但是手动完成应该很容易。获取现有的配色方案,将其粘贴到 ~/.vim/colors/ 目录中,并将 pygments 方案中定义的颜色放入适当的位置。

例如,如果您使用我的配色方案 (使用非标准格式使其更具可编辑性)并使其使用 pygments 秋季方案,您可以采用如下所示的行:

let ColourAssignment['Function'] = {"GUIFG": '#007777', "CTERMFG": 'Cyan'}

并将其更改为如下所示:(

let ColourAssignment['Function'] = {"GUIFG": '#00aa00'}

我已经删除了颜色终端分配,正如您所说的那样,您正在使用GUI,因此很大程度上无关)。

看完整套应该不会花很长时间。我的配色方案主要是为深色背景设计的(如果切换到浅色背景,它会调整颜色),但摆脱这个方面并不难:将“正常”突出显示更改为白色上的黑色而不是白色黑底白字并删除 s:MakeDarker 函数和 if &background == 'light' 块中的位。

或者,您可以使用普通语法突出显示格式执行类似的操作,方法是采用(例如)darkblue.vim 并更改(例如):

hi ErrorMsg     guifg=#ffffff guibg=#287eff                     ctermfg=white ctermbg=lightblue

并将其更改为:

hi ErrorMsg     guifg=#aa0000 guibg=#ffffff                     ctermfg=white ctermbg=lightblue

I haven't come across anything that will automate this process, but it should be very easy to do by hand. Grab an existing colour scheme, stick it in your ~/.vim/colors/ directory and put the colours that are defined in the pygments scheme into the appropriate places.

For example, if you use my colour scheme (which uses a non-standard format to make it more editable) and make it uses the pygments autumn scheme, you could take the line that looks like this:

let ColourAssignment['Function'] = {"GUIFG": '#007777', "CTERMFG": 'Cyan'}

and change it to look like this:

let ColourAssignment['Function'] = {"GUIFG": '#00aa00'}

(I've removed the colour terminal assignment as you've said you're using a GUI and it is thus largely irrelevant).

It shouldn't take very long to go through the whole set. My colour scheme is designed for dark backgrounds primarily (it adjusts colours if you switch to a light background), but it wouldn't be very hard to get rid of this aspect: change the "Normal" highlighting to be black on white rather than white on black and remove the s:MakeDarker function and the bit in the if &background == 'light' block.

Alternatively, you could do a similar thing with the normal syntax highlighting format by taking (e.g.) darkblue.vim and changing (e.g.):

hi ErrorMsg     guifg=#ffffff guibg=#287eff                     ctermfg=white ctermbg=lightblue

and changing it to:

hi ErrorMsg     guifg=#aa0000 guibg=#ffffff                     ctermfg=white ctermbg=lightblue
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文