Introduction to Alacritty: A Lightweight Terminal Emulator
Alacritty, known for its speed and efficiency, stands out as a lightweight and GPU-accelerated terminal emulator. Striking a balance between simplicity and performance, Alacritty has become a popular choice among users seeking a fast and responsive terminal experience.
Navigating the Transition: From alacritty.yml to alacritty.toml
As Alacritty evolves, so does its configuration. If you don't know before version 0.13.0 (78fa4d6f)
alacritty.yml was used as its configuration file. The shift from using alacritty.yml to alacritty.toml brings about a need for users to adapt their customization strategies. In this article, we explore a practical workaround to ensure a seamless transition, specifically addressing the challenge presented by tools like alacritty-themes that were originally tailored for the YAML configuration.
The alacritty-themes was an excellent npm package which as its name suggests was used for theming alacritty. these features made it good at what it was made for
- Live preview of the themes
- 200+ Themes to choose from
- Apply any theme with just one command at the terminal
- Option to create your alacritty.yml config file
- Simple, Easy and intuitive User experience
rajasegar / alacritty-themes
🌈 🍭 Themes 🍬 😍 for Alacritty: A cross-platform GPU-accelerated Terminal emulator
🌈 alacritty-themes 🍭
Themes 🍬 for alacritty A cross-platform, GPU-accelerated terminal emulator
To find the list of themes, you can visit the alacritty wiki page
Live preview the themes- 200+ Themes to choose from
- Apply any theme with just one command at the terminal
- Option to create your
alacritty.toml
config file - Simple, Easy and intuitive User experience
Install
Install the alacritty-themes
package globally with npm
npm i -g alacritty-themes
If you are using npx
you don't have to install the package:
npx alacritty-themes
If you are using Archlinux, you can install it from AUR
paru -S alacritty-themes
Usage
alacritty-themes
To apply a theme directly, provide the theme name as an option
alacritty-themes Dracula
To find the themes, you can check the file names here
Choose the theme from the list of options by typing the theme name and press Enter
to apply
The list of options are cycled through automatically…
But this tool was made for alacritty.yml files and seeing the last commit on it which was 7 months ago as of writing this post, it seems like it will be a while before they fix this problem.
So for this, I found a temporary workaround not as great as the tool.
First, let's move all your alacritty.yml to alacritty.toml for this you'll need to learn toml file format and re-write your entire configuration from yaml to toml, good let's start from the basics. hehe just kidding just run this command
alacritty migrate
Now your alacritty.yml has been converted to alacritty.toml.
Now let's collect some themes we'll use this official alacritty repo of themes collection all are in toml format.
alacritty / alacritty-theme
Collection of Alacritty color schemes
Alacritty Theme
Collection of colorschemes for easy configuration of the Alacritty terminal emulator.
Installation
Imports
Clone the repository, or download the theme of your choice:
# We use Alacritty's default Linux config directory as our storage location here.
mkdir -p ~/.config/alacritty/themes
git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes
Add an import to your alacritty.toml
(Replace {theme}
with your desired
colorscheme):
import = [
"~/.config/alacritty/themes/themes/{theme}.toml"
]
Manual
To manually include a colorscheme in an existing alacritty.toml
, you just need
to copy the entire content of the theme into the root level of your
configuration file.
Color Schemes
NAME | COLORS |
---|---|
afterglow source |
|
alabaster source |
|
alabaster_dark source |
|
alacritty_0_12 source |
|
argonaut source |
|
ashes_dark source |
|
ashes_light source |
|
atom_one_light source |
|
aura source |
|
ayu_dark source |
|
ayu_light source |
|
baitong source |
|
base16_default_dark source |
|
blood_moon source |
|
bluish | |
breeze source |
|
campbell source |
|
carbonfox source |
|
catppuccin_frappe source |
|
catppuccin_latte source |
|
catppuccin_macchiato source |
|
catppuccin_mocha source |
|
challenger_deep source |
|
chicago95 | |
citylights source |
|
Cobalt2 |
Clone this repo where your alacritty.yml file is for it was at ~/.config/alacritty/
so I cloned it there
Use these commands
# We use Alacritty's default Linux config directory as our storage location here.
mkdir -p ~/.config/alacritty/themes
git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes
Now go to your .bashrc
or .zshrc
or whatever your configuration file is for your shell environment and create a alias
add this line
alias themes="ls ~/.config/alacritty/themes/themes | fzf | xargs -I {} ln -sf ~/.config/alacritty/themes/themes/{} ~/.config/alacritt
y/current_theme.toml && echo "@@@" >> ~/.config/alacritty/alacritty.yml && sed -i '/@@@/d' ~/.config/alacritty/alacritty.yml"
To understand what this command is doing let's break it into 4 parts
ls ~/.config/alacritty/themes/themes
This part is just listing the theme files that we git cloned.-
The above command's output is piped into fuzzy finder
fzf
. You can find the installation instructions atSpecial thanks to:
Visit warp.dev to learn more.
fzf is a general-purpose command-line fuzzy finder.
It's an interactive filter program for any kind of list; files, command history, processes, hostnames, bookmarks, git commits, etc. It implements a "fuzzy" matching algorithm, so you can quickly type in patterns with omitted characters and still get the results you want.
Highlights
- 📦 Portable — Distributed as a single binary for easy installation
- ⚡ Blazingly fast — Highly optimized code instantly processes millions of items
- 🛠️ Extremely versatile — Fully customizable via an event-action binding mechanism
- 🔋 Batteries included — Includes integration with bash, zsh, fish, Vim, and Neovim
Sponsors ❤️
I would like to thank all the sponsors of this project who make it possible for me to continue to improve fzf.
If…
Now the output of fuzzy finder is piped into
xargs -I {} ln -sf ~/.config/alacritty/themes/themes/{} ~/.config/alacritt
This is creating a symbolic link at
y/current_theme.toml~/.config/alacritty/current_theme.toml
for the theme file that you selected in fuzzy finder like if you selected gruvbox.toml in fzf it'll create a symbolic link for~/.config/alacritty/themes/themes/gruvbox.toml
to here~/.config/alacritty/current_theme.toml
.The last part is this
echo "@@@" >> ~/.config/alacritty/alacritty.yml && sed -i '/@@@/d' ~/.config/alacritty/alacritty.yml
this is just appending a@@@
string at the end of the alacritty.toml file and removing it I'll tell you the reason for this later.
okay now you just need to add this line to your alacritty.toml file
import = [
"~/.config/alacritty/current_theme.toml"
]
Remove any color scheme in your toml file because if there is already manual color scheme the import of the theme file will not work. All should work now just enter your alias command > choose the theme > press enter and that's it.
Now to explain the reason for the 4 part is that remember we created a symbolic link at ~/.config/alacritty/current_theme.toml
for the theme file we'll select and have added an entry of importing it in alacritty but as you'll run the complete command you will not see any color scheme change that is because you have changed the content of current_theme.toml
(more specifically it's redirection location) not the content of alacritty.toml
and alacritty only refreshes if it detects any changes in it's configuration file the complete command (the 4th part) cause some change in file by adding @@@
and removing it next so the color scheme refreshes.
Top comments (0)