我现在想找一款light mode的theme,希望它在gui和terminal上表现同样好,但是试用了几个,感觉观感都不是很好。 朋友们可以推荐一下你们在用的themes吗?
试试koishi-theme,可以自己调色
terminal上用亮色怪怪的,我觉得用亮色比较好。我自己是modus-theme稍微改淡了一点点。
(use-package modus-themes
:ensure t
:demand t
:custom
(modus-themes-bold-constructs t)
(modus-themes-italic-constructs t)
(modus-themes-mixed-fonts t)
:init
(setopt
modus-themes-common-palette-overrides
'((border-mode-line-active bg-mode-line-active)
(border-mode-line-inactive bg-inactive)
(bg-hl-line bg-dim)
(bg-line-number-inactive bg-dim)
(fg-line-number-inactive fg-dim)
(fringe unspecified)
(underline-err red)
(underline-warning yellow-faint)
(underline-note cyan-faint)))
:config
(defvar my--gui-theme 'modus-operandi-tinted)
(defvar my--tty-theme 'modus-vivendi-tinted)
(defun my--load-theme-for-frame (frame)
"Load theme after FRAME generated."
(let ((theme-to-load
(if (display-graphic-p frame) my--gui-theme my--tty-theme)))
(unless (memq theme-to-load custom-enabled-themes)
;; Disable all enabled themes
(mapc #'disable-theme (copy-sequence custom-enabled-themes))
(condition-case err
(load-theme theme-to-load t)
(error
(message "Error loading theme %s: %S" theme-to-load err))))))
;; Note that this hook runs only for creating new frame.
(add-hook 'after-make-frame-functions #'my--load-theme-for-frame)
;; Ensure the initial frame has the appropriate theme.
(when (display-graphic-p (selected-frame))
(my--load-theme-for-frame (selected-frame))))
要想在 GUI 和 Terminal 都表现好,那应该找一些比较成熟、用的人多的主题。
首先推荐的就是 modus-themes。
modus-themes 的作者 Protesilaos 还制作了 ef-themes (颜色更鲜艳),doric-themes(颜色更单调)也都可以试试,这三个主题都有一系列亮色主题。
我觉得 Protesilaos 品味不错,这些主题的用户不少,容易发现问题,修复问题也很快。 而且 Prot 的主题文档很齐全,告诉了你怎么基于他的主题扩展,自己稍微做点修改应该相对简单。
这三个主题都提供了随机切换的 API,一个主题看厌了你就可以随机换一个,如果你感兴趣,这里提供一个我自己的实现: 在 Emacs 随机切换主题。甚至你还可以基于日光时间,自动切换亮色暗色主题,见:根据时间切换 emacs theme 。
Purcell 用的 sanityinc 系列也不错。
除此之外,你说到「找」,你可以在论坛中搜索主题,也有不少帖子,例如:大家 Emacs 都用什么主题?
也可以看看 Sacha Chua 写的 Emacs News,里面有一个部分是 Appearance,偶尔也会分享一些别人的主题。
又或者找一下别人的 Emacs 配置,看看他的主题用的是什么。
最后,如果依然找不到满意的,那就学一下怎么写主题,DIY 吧。
我个人不建议自己diy主题,极其费时间。。。
主题东西带有浓烈的个人偏爱, 大家都习惯的你不一定喜欢
可以多逛逛reddit或者emacs themes网站, 主题非常多, 总有一款看对眼的
我之前试过论坛中推荐的许多主题, 总感觉不是自己的菜, 直到有一天逛reddit看到了nimbus, 试用了一下感觉很对眼, 就一直用了 ![]()
参考emacs自带主题,自己改改。
我比较懒,直接在 Doom Emacs’ Theme Pack 里面找的,其中有两个主题特别喜欢,于是选择全部都要:
(use-package doom-themes
:custom
(doom-themes-enable-bold t)
(doom-themes-enable-italic t)
:config
(load-theme 'doom-nord-aurora t)
(doom-themes-visual-bell-config)
(doom-themes-org-config))
(defvar sztk-theme-circle '(doom-nord-aurora doom-gruvbox))
(defun sztk-toggle-theme ()
(interactive)
(let* ((current-theme (car custom-enabled-themes))
(next-theme (or (cadr (member current-theme sztk-theme-circle))
(car sztk-theme-circle))))
(load-theme next-theme t)
(mapc #'disable-theme (cdr custom-enabled-themes))
(message "Theme: %s" next-theme)))
(keymap-global-set "C-c y" #'sztk-toggle-theme)
当然我并不是 Doom Emacs 用户,只是感到借助 Doom 的主题包比较方便。想要看谁的效果,M-x load-theme,就直接有很多选择
推荐试试 gruber-darker-theme 。我是在这个主题的基础上增强了下自己常用mode的支持,使用了2个多月了,感觉很好。估计能用很长时间。
可惜这个主题没有对应的浅色主题。不过我自己动手撸了一个,用着也还不错。
个人自用的主题链接:
我之前是直接用的懒猫大大的theme
后来发现我只是喜欢懒猫的灰色和绿色配色, 所以现在用的是默认theme + 自定义颜色, 最简单(
(load-theme 'tango-dark)
;; tweek
;; prefer green on black(or gray)
;; blue is the color of the wisdom(conosuba)
(set-face-attribute 'mode-line nil
:foreground "green"
:background "DarkBlue")
(set-face-attribute 'default nil
:foreground "green"
:background "#252525")
如果要和 terminal gui 统一,那恐怕还得是大品牌,catppuccin ,nord 这种生态丰富的
consult 有个 consult-theme,可以装一大堆 theme(如 doom-themes 的一大堆)然后自己在常用 mode 里面试:

顺便自荐一个自己搭的 theme gallery:
感谢楼上各位的回复,看了一下@balkin 和@Spike-Leung 提到modus-theme,我发现’modus-operandi-tinted好像还挺合我审美的,目前用下来暂时没发现什么问题,先用着看看吧。
很好的建议,谢谢你!
谢谢你,看了下modus,感觉modus-operandi-tinted还挺好,我稍微改了改就用上了。
modus-vivendi + 透明背景 很好看
上个截图?zsbd
应该大概是这个样子吧,这是 macOS 上的截图,背景是 macOS 上设置的桌面图片,透明度是 purcell 的一段代码实现的:
代码
(defun sanityinc/adjust-opacity (frame incr)
"Adjust the background opacity of FRAME by increment INCR."
(unless (display-graphic-p frame)
(error "Cannot adjust opacity of this frame"))
(let* ((oldalpha (or (frame-parameter frame 'alpha) 100))
;; The 'alpha frame param became a pair at some point in
;; emacs 24.x, e.g. (100 100)
(oldalpha (if (listp oldalpha) (car oldalpha) oldalpha))
(newalpha (+ incr oldalpha)))
(when (and (<= frame-alpha-lower-limit newalpha) (>= 100 newalpha))
(modify-frame-parameters frame (list (cons 'alpha newalpha))))))
(global-set-key (kbd "M-C-8") (lambda () (interactive) (sanityinc/adjust-opacity nil -2)))
(global-set-key (kbd "M-C-9") (lambda () (interactive) (sanityinc/adjust-opacity nil 2)))
(global-set-key (kbd "M-C-7") (lambda () (interactive) (modify-frame-parameters nil `((alpha . 100)))))
不过透明有个小问题,就是会看到后面的应用,有时会比较碍眼。 透明适合暗色的主题,让暗色主题不那么刺眼,但不太适合亮色主题,会让亮色主题看起来不够清晰。
(倒是提醒我了,我可以在切换暗色主题的时候都设置一个透明度,切换亮色的时候重置回来,这样暗色主题看起来就更好看了)
代码
(defun light()
"Load random light themes."
(interactive)
(setq spike-leung/current-theme-background-mode 'light)
(spike-leung/themes-load-random 'light)
(modify-frame-parameters nil `((alpha . 100))))
(defun dark()
"Load random dark themes."
(interactive)
(setq spike-leung/current-theme-background-mode 'dark)
(spike-leung/themes-load-random 'dark)
(let ((theme (format "%s" custom-enabled-themes)))
(cond
((string-match-p (rx (or "modus-" "ef-")) theme)
(modify-frame-parameters nil `((alpha . 80))))
((string-match-p "doric-" theme)
(modify-frame-parameters nil `((alpha . 90)))))))
