This package provides utilities for displaying elements of the mode line as tabs and ribbons. It also provides replacements for a few built-in elements.
To style the buffer identification, displayed in the mode line, as shown in the above screenshot, add the following to your init file.
(require 'moody)
(moody-replace-mode-line-front-space)
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode)
Or if you are using use-package
.
(use-package moody
:config
(moody-replace-mode-line-front-space)
(moody-replace-mode-line-buffer-identification)
(moody-replace-vc-mode))
Moody provides functions named moody-replace-...
, each of which
replaces a particular element with a styled variant. These functions
can also be called interactively, in which case they toggle between
using the styled and vanilla variants of their respective element.
To learn what element substitutions are available out of the box, use
M-x moody-replace- TAB
.
Depending on the used theme, the mode-line
and mode-line-inactive
faces might need some additional/alternative styling, when using
Moody.
Let’s go through some changes that are commonly required. We will be
using set-face-attribute
to achieve this. The calls to that function
should be placed right after load-theme
.
Many themes set the :box
attribute for these faces. That doesn’t work
for Moody, so you might have to remove that.
(set-face-attribute 'mode-line nil :box nil)
(set-face-attribute 'mode-line-inactive nil :box nil)
If these faces inherit from other faces, you might have to use
unspecified
, instead of nil
.
A look similar to boxes can be achieved by using the :overline
and
:underline
attributes.
(set-face-attribute 'mode-line nil :overline "blue")
(set-face-attribute 'mode-line nil :underline `(:color "blue" :position t))
(set-face-attribute 'mode-line-inactive nil :overline "green")
(set-face-attribute 'mode-line-inactive nil :underline `(:color "green" :position t))
Beginning with Emacs 29.1, we can use :position t
to put the underline
at the very bottom of the mode line. When using an older release, then
this unfortunately can only be enabled globally.
(setq x-underline-at-descent-line t)