如何使Emacs终端颜色与Emacs GUI颜色相同? [英] How to make Emacs terminal colors the same as Emacs GUI colors?

查看:152
本文介绍了如何使Emacs终端颜色与Emacs GUI颜色相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu上的Emacs程序(目前为哈代苍鹭),我喜欢Emacs GUI中的默认文字着色。但是,Emacs在终端中运行时的默认文本着色是不同的,而且很多。



如何使终端中的颜色与GUI中的颜色匹配? / p>

解决方案

您不必被卡在终端的默认16(或更少)颜色上。现代终端将支持256种颜色(这将使您非常接近您的GUI外观)。



不幸的是,让终端支持256种颜色是棘手的部分,从术语到术语。 这个页面帮了我很多东西(但它过期;我已经在gnome终端和xfce4终端中使用了256种颜色,但是您可能需要从源代码构建它们。)



一旦你的终端快乐地使用了256种颜色,魔术调用就是将您的终端类型设置为xterm-256color,然后再调用emacs,例如:

  env TERM = xterm-256color emacs -nw 

或者,你可以在 .bashrc 文件中设置TERM:

  export TERM = xterm- 256color 

您可以通过执行 Mx列表颜色来检查它是否在emacs中工作 - 显示,将显示16或全部256种光彩的颜色。



如果它有效,那么看看 color-theme 像别人建议的那样。



(你可能会在某些时候感到沮丧; g od知道我每次尝试做类似的事情。但坚持下去这是值得的。)


I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration in the Emacs GUI. However, the default text coloration when Emacs is run in the terminal is different and garish.

How do I make the colors in the terminal match the colors in the GUI?

解决方案

You don't have to be stuck to your terminal's default 16 (or fewer) colours. Modern terminals will support 256 colours (which will get you pretty close to your GUI look).

Unfortunately, getting your terminal to support 256 colours is the tricky part, and varies from term to term. This page helped me out a lot (but it is out of date; I've definitely gotten 256 colours working in gnome-terminal and xfce4-terminal; but you may have to build them from source.)

Once you've got your terminal happily using 256 colours, the magic invocation is setting your terminal type to "xterm-256color" before you invoke emacs, e.g.:

env TERM=xterm-256color emacs -nw

Or, you can set TERM in your .bashrc file:

export TERM=xterm-256color

You can check if it's worked in emacs by doing M-x list-colors-display, which will show you either 16, or all 256 glorious colours.

If it works, then look at color-theme like someone else suggested.

(You'll probably get frustrated at some point; god knows I do every time I try to do something similar. But stick with it; it's worth it.)

这篇关于如何使Emacs终端颜色与Emacs GUI颜色相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆