DEV Community

loading...
Cover image for alacritty-themes: A CLI tool to set themes for alacritty terminal

alacritty-themes: A CLI tool to set themes for alacritty terminal

rajasegar profile image Rajasegar Chandran ・2 min read

In this post we are going to take a look at a new CLI tool I have created for customizing colors for your alacritty terminal.

What is alacritty?

alacritty is a cross-platform, GPU-accelerated terminal emulator written in Rust. Using the GPU for rendering enables optimizations that simply aren't possible without it. It currently supports macOS, Linux, BSD, and Windows.

It is incredibly fast and responsive to the extent that I have replaced iterm2 with alacritty for my Macbook, my Ubuntu Laptop and my RasberryPi ArchLinux system. I have been using it for a while now and I really love it.

You can config your alacritty terminal by having a config file called alacritty.yml in your home folder like ~/.config/alacritty/alacritty.yml

alacritty-themes CLI

Configuring your terminal with yml files is definitely fun. But when it comes to customizing colors it definitely needs an intuitive tool for the job. That's why I have created alacritty-themes for that.

To find the list of themes, you can visit the alacritty wiki page

The CLI offers 50+ Themes to choose from, an option to create your alacritty.yml config file with a simple, easy and intuitive user experience.

It is using yaml and inquirer npm packages for parsing the config yml and giving a list of themes to choose from the terminal respectively.

How do I install it?

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

How do I select themes?

alacritty-themes

alacritty-themes demo gif

Choose the theme from the list of options and press Enter to apply.
You can also navigate with j and k keys for up/down, courtesy of inquirer. The list of
options are cycled through automatically so you can go to the last theme
by just pressing up arrow key.

I am using the One-Dark theme, you also have popular themes like Dracula, Monokai, etc.,

If no alacritty.yml is found in your $HOME path, it will ask you to create one.
You can choose to create one by confirming (y/n) and apply the selected theme.

Bonus Tip: Alias

You can also create an alias for alacritty-themes like at
Just append this below line to your ~/.bashrc or ~/.bash_profile

alias at='alacritty-themes'

Now you can simply use at to choose themes for your alacritty terminal.

at

If you have any feedback in improving the tool, or queries about the tool, please let me know in the comments. Also try alacritty as your terminal emulator and tell us what is your favorite theme.

Discussion (11)

pic
Editor guide
Collapse
moinmoti profile image
Moin Hussain Moti

Hi, thanks for the awesome plugin, however, I am getting this error on running it on Linux Mint 19.3 Cinnamon.

internal/fs/utils.js:220
throw err;
^

Error: ENOENT: no such file or directory, scandir './themes'
at Object.readdirSync (fs.js:854:3)
at Object. (/home/moinmoti/.nvm/versions/node/v12.13.1/lib/node_modules/alacritty-themes/bin/cli.js:7:19)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11 {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: './themes'
}

Collapse
moinmoti profile image
Moin Hussain Moti

So it requires the user to create a "themes" directory and save all themes in ".yml" individual files. And the command must be called in the parent directory of "themes". I think these instructions should be mentioned in the README.

Collapse
rajasegar profile image
Rajasegar Chandran Author

Sorry for the trouble, it was a bug due to the file system path reference, it's fixed in the latest version 1.1.4, please check and let me know. Thanks a lot for reporting that...
And you don't have to create any folder for themes or copy files, just install the program and run the command or use npx directly

Thread Thread
angelhpascual profile image
Angelhpascual

I have this error

(node:51812) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/home/angelhpascual/themes/alacritty.yml'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at inquirer.prompt.then (/usr/local/lib/node_modules/alacritty-themes/index.js:59:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:51812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:51812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

some fix for that? Thank you!

Thread Thread
rajasegar profile image
Rajasegar Chandran Author

Fixed it here, please try with the latest version
github.com/rajasegar/alacritty-the...

Collapse
grtcdr profile image
grtcdr

I love this, I always hated the classic way of changing my colorscheme! Thanks for this awesome tool :)

Collapse
rashil2000 profile image
Rashil Gandhi

Hi, this looks like an awesome tool!

However it didn't work on Windows. Not to worry though, I've fixed that and sent a PR :)

Collapse
rajasegar profile image
Rajasegar Chandran Author

thanks for the PR Rashil, I've merged it

Collapse
adionicas profile image
_o__n__i_

How can I uninstall this? npm uninstall alacritty-themes and npm remove alacritty-themes does not work

Collapse
rajasegar profile image
Rajasegar Chandran Author

If it is installed globally I think you need the --global flag for the same like , npm uninstall --global alacritty-themes

Collapse
alenpaul2001 profile image
AlenPaulVarghese

Is there any way to make it live? By live I meant apply the theme without exiting the program or changing its scroll position?