2020-12-09, updated: 2024-03-12

Tested with Nyxt 2.1.1.

Tags: howto.

Theming Nyxt, midnight theme

Theming Nyxt, midnight theme

By John Mercouris

Theming Nyxt is straightforward and powerful. Every class has an associated style slot (attribute) composed of CSS. You can change/append to this slot to modify the default theme, or create your own from scratch.

For the purposes of this article, we'll be modifying the default theme to make a dark version.

The first thing we'll change is the appearance of the prompt-buffer:

What we've done here is concatenated the %slot-default of the minibuffer style with our own CSS that changes the background color and text color.

Next, let's handle the appearance of internal buffers. Internal buffers are used when you create any kind of buffer that is populated by Nyxt (help buffers, list messages, list buffers, etc).

Here we've added styling for <hr> elements and for .buttons.

Finally, we come to our first, and only special case, windows. For windows we must set the message-buffer-style to control the appearance of the message area at the bottom of the window.

Et voila!

We hope you enjoy making Nyxt your own. Please feel free to share your themes that you create on our communication channels, we'd love to see what you can come up with! Thanks for reading :-)

Future Work

We believe that this system could be further enhanced by the creation of a define-theme macro/framework (built on top of the define-configuration macro). This framework could provide facilities to design and manage themes.

Installation/uninstallation of themes could be fully functional. You could test and develop as many themes as you like without leaving your system in a corrupt state. We're excited to see what we can come up with together!


Did you enjoy this article? Register for our newsletter to receive the latest hacker news from the world of Lisp and browsers!