自定义emacs电力线主题
我试图使我的电源线有一个自定义颜色的第二部分 我使用的代码如下:自定义emacs电力线主题,emacs,elisp,powerline,Emacs,Elisp,Powerline,我试图使我的电源线有一个自定义颜色的第二部分 我使用的代码如下: (require 'powerline) (defface my-pl-segment1-active '((t (:foreground "#3C3F41" :background "#3C3F41"))) "Powerline first segment active face.") (defface my-pl-segment1-inactive '((t (:foreground "#3C3F41" :bac
(require 'powerline)
(defface my-pl-segment1-active
'((t (:foreground "#3C3F41" :background "#3C3F41")))
"Powerline first segment active face.")
(defface my-pl-segment1-inactive
'((t (:foreground "#3C3F41" :background "#3C3F41")))
"Powerline first segment inactive face.")
(defface my-pl-segment2-active
'((t (:foreground "#4fddb0" :background "#4fddb0")))
"Powerline third segment active face.")
(defface my-pl-segment2-inactive
'((t (:foreground "#4fddb0" :background "#4fddb0")))
"Powerline third segment inactive face.")
(defface my-pl-segment3-active
'((t (:foreground "#3C3F41" :background "#3C3F41")))
"Powerline second segment active face.")
(defface my-pl-segment3-inactive
'((t (:foreground "#3C3F41" :background "#3C3F41")))
"Powerline second segment inactive face.")
;; My custom powerline theme: see <https://github.com/milkypostman/powerline/blob/master/powerline-themes.el> to get your own.
(defun my-powerline-theme ()
"Setup the default mode-line."
(interactive)
(setq-default mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
(mode-line (if active 'my-pl-segment1-active 'my-pl-segment1-inactive))
(face1 (if active 'my-pl-segment2-active 'my-pl-segment2-inactive))
(face2 (if active 'my-pl-segment3-active 'my-pl-segment3-inactive))
(separator-left (intern (format "powerline-%s-%s"
(powerline-current-separator)
(car powerline-default-separator-dir))))
(separator-right (intern (format "powerline-%s-%s"
(powerline-current-separator)
(cdr powerline-default-separator-dir))))
(lhs (list (powerline-raw "%*" nil 'l)
(when powerline-display-buffer-size
(powerline-buffer-size nil 'l))
(when powerline-display-mule-info
(powerline-raw mode-line-mule-info nil 'l))
(powerline-buffer-id nil 'l)
(when (and (boundp 'which-func-mode) which-func-mode)
(powerline-raw which-func-format nil 'l))
(powerline-raw " ")
(funcall separator-left mode-line face1)
(when (boundp 'erc-modified-channels-object)
(powerline-raw erc-modified-channels-object face1 'l))
(powerline-major-mode face1 'l)
(powerline-process face1)
(powerline-minor-modes face1 'l)
(powerline-narrow face1 'l)
(powerline-raw " " face1)
(funcall separator-left face1 face2)
(powerline-vc face2 'r)
(when (bound-and-true-p nyan-mode)
(powerline-raw (list (nyan-create)) face2 'l))))
(rhs (list (powerline-raw global-mode-string face2 'r)
(funcall separator-right face2 face1)
(unless window-system
(powerline-raw (char-to-string #xe0a1) face1 'l))
(powerline-raw "%4l" face1 'l)
(powerline-raw ":" face1 'l)
(powerline-raw "%3c" face1 'r)
(funcall separator-right face1 mode-line)
(powerline-raw " ")
(powerline-raw "%6p" nil 'r)
(when powerline-display-hud
(powerline-hud face2 face1)))))
(concat (powerline-render lhs)
(powerline-fill face2 (powerline-width rhs))
(powerline-render rhs)))))))
(my-powerline-theme)
(需要“电力线”)
(defface my-pl-SECTION1-active
"(t:前景"3C3F41":背景"3C3F41))
“电力线第一段活动面。”)
(defface my-pl-SECTION1-inactive
"(t:前景"3C3F41":背景"3C3F41))
“电力线第一段非活动面。”)
(defface my-pl-SECTION2-active
“((t(:前景“#4fddb0”:背景“#4fddb0”))
“电力线第三段活动面。”)
(defface my-pl-SECTION2-inactive
“((t(:前景“#4fddb0”:背景“#4fddb0”))
“电力线第三段非活动面。”)
(defface my-pl-SECTION3-active
"(t:前景"3C3F41":背景"3C3F41))
“电力线第二段活动面。”)
(defface my-pl-SECTION3-inactive
"(t:前景"3C3F41":背景"3C3F41))
“电力线第二段非活动面。”)
;; 我的自定义电源线主题:查看以获得自己的。
(取消我的电源线主题()
“设置默认模式行。”
(互动)
(setq默认模式行格式
“(%e”
(:eval
(let*((激活(电源线选择窗口激活))
(模式线(如果激活“my-pl-segment1-active”my-pl-segment1-inactive))
(面1(如果激活“my-pl-segment2-active”my-pl-segment2-inactive))
(面2(如果激活“my-pl-segment3-active”my-pl-segment3-inactive))
(分隔符左侧(内部)(格式为“电力线-%s-%s”
(电力线电流分离器)
(车辆电源线默认分隔符dir)
(右分隔符(实习生)(格式为“电力线-%s-%s”
(电力线电流分离器)
(cdr电力线默认分隔符dir)
(左侧(列表(电力线原始“%*”无)
(当电力线显示缓冲区大小时)
(电力线缓冲区大小为零)
(电力线显示mule信息时)
(电力线原始模式线路mule信息无)
(电源线缓冲区id为nil'l)
(何时(和(边界“哪个函数模式”)哪个函数模式)
(电力线原始函数格式为nil'l))
(电力线原始)
(funcall分隔符左模式线面1)
(当(边界erc修改通道对象)
(电力线原始erc修改通道对象面1'l))
(电力线主模式面1'l)
(电力线过程面1)
(电力线次要模式面1'l)
(电力线窄面1'l)
(电力线原始“面1)
(所有分隔符左侧面1面2)
(电力线vc面2'r)
(当(绑定和真实p nyan模式)
(电力线原始(列表(nyan创建))面2'l)
(rhs(列表(电力线原始全局模式字符串面2'r)
(所有分隔符右侧面2面1)
(除非是车窗系统
(电力线原始(字符到字符串#xe0a1)面1'l))
(电力线原始“%4l”面1'l)
(电力线原始):“面1'l)
(电力线原始“%3c”面1'r)
(所有分隔符右侧面1模式线)
(电力线原始)
(电力线原始“%6p”零'r)
(当电源线显示hud时)
(电力线hud面2面1(()()))
(concat(电力线渲染左侧)
(电力线填充面2(电力线宽度rhs))
(电力线渲染rhs(()()())))
(我的电力线主题)
我遇到的基本问题是,'my-pl-segment2-active:background
影响文本颜色和分隔符的颜色。有办法把它们分开吗
'my-pl-segment2-active:背景为黑色的图片
:
'my-pl-segment2-active:backgrounde
与前景相同的图片(#4fddb0
):
您需要添加一个额外的面,其中背景代表背景色,前景完全不做任何事情
在旁边声明它(face2(如果激活'my-pl-segment2-active my-pl-segment2-inactive')
。(例如:(新面孔(如果激活“我的pl固定面孔激活我的pl固定面孔未激活”)
)
然后将包含“分隔符”的行中的face1
替换为新面的名称(如步骤2中所述)(例如:(funcall separator right face2 face1)
=>(funcall separator right face2 newface)
)