Catppuccin Themes with Auto-Dark in Emacs

Cover Image for Catppuccin Themes with Auto-Dark in Emacs
Rahul M. Juliato
Rahul M. Juliato
#emacs#auto-dark# catppuccin

Discover the Beauty of Catppuccin Themes in Emacs, Coupled with Auto-Dark, Crafting a Perfectly Tailored and Eye-Pleasing Coding Experience. We hope you found this guide enjoyable and useful. If you have any questions or need help, please don't hesitate to reach out by opening an issue on the Auto-Dark-Emacs repository.

What is auto-dark ?

In today's digital world, the interface of your preferred text editor plays a crucial role in your productivity. As developers and writers, we often spend long hours staring at our screens, and it's essential that our tools are easy on the eyes. One vital aspect of this is choosing the right color scheme, or theme, for your text editor. However, we all know that our surroundings change throughout the day, and we want our tools to adapt to those changes as well. This is where Auto-Dark for Emacs comes into play.

Auto-Dark is a nifty Emacs package available via MELPA that ensures your Emacs environment changes its theme based on your operating system's dark-mode settings. Whether you're using macOS, Linux, or Windows, this tool seamlessly integrates with your system's preferences.

How Does Auto-Dark Work?

auto-dark-demo

Auto-Dark simplifies the process of switching between two user-defined themes that automatically change when your system's dark mode is toggled on or off. It currently supports Linux through Gnome and Termux for Android users, with more platforms potentially being added in the future. The default themes are 'wombat' and 'leuven,' as these are bundled with Emacs.

Installing Auto-Dark is straightforward. You can easily grab it from MELPA and add the following lines to your .emacs or ~/.emacs.d/init.el file:

(require 'auto-dark)
(auto-dark-mode t)

For more detailed guides, tips, and tricks on setting up Auto-Dark with Spacemacs and DoomEmacs, you can explore the official Auto-Dark Emacs repository on GitHub. Here, you'll find comprehensive documentation and resources to help you get the most out of this handy package. The repository can be found at Auto-Dark on GitHub.

The light/dark themes can be customized using the Emacs customization system: M-x customize-group auto-dark.

Or set directly with:

(setq auto-dark-themes '((doom-one) (doom-one-light)))

Why Catppuccin?

In the colorful world of code theming, Catppuccin stands as a testament to the perfect balance between visual aesthetics and functionality. This community-driven pastel theme is meticulously crafted to be the sweet spot between low and high contrast themes. With four soothing "flavors," each offering a palette of 26 eye-catching colors, Catppuccin isn't just for coding—it's a delightful experience that enhances your designing and much more.

Within the Catppuccin package, you'll discover four distinct "flavors": Latte, Frappe, Macchiato, and Mocha. Each variant presents a unique shade, allowing you to choose your preferred level of contrast, whether you're inclined towards a darker or lighter theme.

catppuccin

Catppuccin isn't just a theme; it's become a substantial project in its own right. You can explore the expansive world of Catppuccin on Catppuccin Repo, where it has left its mark on various platforms. You might have already encountered Catppuccin on your terminal emulator, in your tmux configuration, on your Chrome browser, within your Discord server, and across several code editors. And, of course, it's made its way into the heart of one of the most beloved text editors—Emacs.

Catppuccin and Emacs: A Perfect Blend

The Emacs variation of Catppuccin has found a special place in the hearts of many, including myself. I've had the privilege of contributing to this project by theming bits of various packages, such as: Ivy, Popup, Swiper, Counsel, LSP-Mode, Indent-Guide, and Treemacs. It's a testament to the open-source spirit, where collaboration and creativity come together to create something truly exceptional.

emacs-catppuccin

Before we wrap up, I'd like to give a shout-out to the fantastic contributors who have made Catppuccin what it is today. Special thanks to @Name and @Nyx for your patience, guidance, and the joy of collaboration. 😄

Bringing Catppuccin and Auto-Dark Together

Catppuccin, with its unique theme and variations, uses variable settings for its flavors. However, these settings don't align perfectly with Auto-Dark, which expects separate dark and light themes. To make them work harmoniously, we can leverage the flexibility of Auto-Dark's hook system.

Here's a snippet to configure the integration:

(use-package auto-dark
  :ensure t
  :config
  (ignore-errors
    (setq auto-dark-themes '((catppuccin) (catppuccin)))

    (add-hook 'auto-dark-dark-mode-hook
              (lambda ()
                (setq catppuccin-flavor 'mocha)
                (catppuccin-reload)))

    (add-hook 'auto-dark-light-mode-hook
              (lambda ()
                (setq catppuccin-flavor 'frappe)
                (catppuccin-reload)))

    (auto-dark-mode 1)))

With this setup, Catppuccin seamlessly adapts to your system's dark and light modes, ensuring a smooth and visually pleasing coding experience.

Explore this dynamic duo, make your Emacs environment uniquely yours, and I hope you found this guide enjoyable and useful. Happy theming!

If you have any questions or doubts, please feel free to open an issue on the Auto-Dark Repository. Your feedback and inquiries are always welcome!