Continuing my modeline customisation with powerline, I wanted to add colour to match the Cyberpunk theme of Emacs Live. To do this I copied the default them and custmised it, adding colours and chaning the style of seperatr. Here is how I customised the powerline code to make my own theme.
Although the arrows are nice way to seperate the different parts of the modeline, I tried out the different styles. My favorite was the
To change the style, I edited the
lib/powerline.el file and change the
powerline-default-separator to the value to
wave. The choice list shows you all the styles of seperator available.
(defcustom powerline-default-separator 'wave
I restarted Emacs each time I changed the seperator style for it to take effect. I am not sure how to update the style without a restart.
I wanted to change the colours of the modeline to make it more personal to me and also help it stand out between all the text of the buffers.
Rather than mess up the default theme I simply edited the
lib/powerline/powerline-theme.el file and copied the default theme completely, called the new theme
powerline-default-theme. This allowed me to experiment whilst still having a working reference theme to fall back on.
To use my new theme, I edited the configuration file
~/.live-packs/jr0cket-pack/config/powerline.el and changed the line defining the theme
There are some of the elements I was not interested in, such as the size of buffer and mule-info. So I edited my jr0cket theme and removed the lines
(powerline-buffer-size nil 'l)
The default theme adds padding between some elements by adding a space character.
(powerline-raw " ")
There was aso padding around some elements on the modeline, specifically the line
l & column
c numbers and the percentage of buffer above the currently visible text
p. The default theme adds numbers in front of these caracters adds padding, which I didnt feel was needed so I deleted those numbers.
(powerline-raw "%l" face1 'l)
The powerline default theme is very grey, so I wanted to add some colours that would work with the Emacs Live Cyberpunk theme. Changing colours is done in the
I changed the text colour using
:foreground, the background colour with
:backgroundand made the text bold using
(defface powerline-active1 '((t (:foreground "#d0d0f0" :background "purple" :inherit mode-line)))
The defalt powerline theme has two faces (styles) for inactive and active windows -
powerline-inactive2 Different parts of the modeline are assigned to one of the faces and therefore display in different styles. There are a few parts of the modeline, like the buffer name, that are not assinged to a face and display in the colour of the Emacs theme (Emacs Live)
I wanted to change the style of the buffer name, so rather than change the Emacs theme I added a third face to the
(defface powerline-active0 '((t (:foreground "deep pink" :weight bold :background "black" :inherit mode-line)))
I then tried out different colours for the buffer name and settled on the reverse of face0, so updated the
lib/powerline/powerline.el file by adding an
inactive0 configuration as follows:
(defface powerline-active0 '((t (:foreground "purple" :weight bold :background "#d0d0f0" :inherit mode-line)))
The final active modeline with my theme and colours applied looks very nice and very useful to me
Here is the overal view of Emacs with the jr0cket theme and colours applied.
Here is the complete code for the
(defun powerline-jr0cket-theme ()
Powerline is a really nice way to add that extra touch to the Emacs experience. Its also pretty easy to configure to give you your own personalised look to the Emacs modeline. Let me know if you have any interesting customisations to your Emacs setup.
This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket