Automating Slack’s Day/Night modes with Command-Line Scripts

Ikechi Michael
Nov 13, 2018 · 3 min read
Once you slack, you never go back

A few days ago, I discovered this article, shared on Andela’s Slack’s #random channel, which gives you a dark mode on your Slack app for Mac.

This means that my slack, which used to look like this (day):


Now looks like this (dark):


and sometimes like this (aubergine):

If you like these, there are a couple more variant looks you might be interested in, however in this article, we’ll be looking at automatically switching slack to night-mode in the evenings 🌘 and back to day-mode when the Sun is up in the mornings. ☀️

This is useful if you prefer not to strain your eyes when working on slack.

Switching to night mode is easy (kinda).

There’s a CSS file existing here, which you can make sure Slack adds to its document’s<head> when it's done loading, by appending:



on your Mac.

To return to day mode, you have to replace the original ssb-interop.js file, that does not load the night-mode stylesheet.

We’ll write shell commands to trigger these actions at the right time 😄. Excited?

Shell-Scripts to switch themes

To make things easy, I’ve written these shell-scripts to make switching themes easy. To quickly set up on your Mac, you can run the following in the terminal:

curl -O && sh slack-theme install && . ~/.bash_profile

This will give you the slack-theme command you can run like:


to see the help info, and slack-theme night to switch to night-mode. Other commands are:

slack-theme day
slack-theme night
slack-theme night-mono
slack-theme aubergine
slack-theme aubergine-mono
slack-theme arc-dark
slack-theme midnight-blue
slack-theme midnight-blue-mono

Scheduling Tasks

For scheduling tasks in unix systems, we have the cron tool … We can schedule a task by running

crontab -e

and adding text in the format:

1 2 3 4 5 /full/path/to/script


  1. represents Minutes (0 - 59)
  2. Hours (0 - 23)
  3. Days (1 - 31)
  4. Month (1 - 12)
  5. Day-of-the-week (1 - 7)

Schedule Night-Mode for 6pm (18:00) 🌘

With this, we can run crontab -e, and enter:

0 18 * * * /full/path/to/slack-night

If your default editor is vim, you might want to press i to begin INSERT mode, and ESC before:x followed by ENTER to save and exit. 😅

Be sure to replace /full/path/to/ with the actual full path to the folder where the slack-theme, slack-day and slack-night scripts are located. You can find the full path to slack-night by running which slack-night in your terminal.

Schedule Day-Mode for 8am (08:00) ☀️

You might want to revert to the day theme when it’s daytime, and you can do that with the crontab -e, followed by appending:

0 9 * * * /full/path/to/slack-day

to the previous entry.

What we’ve learned

  • That it’s possible to modify slack’s general look and feel
  • How to install and use the slack-theme tool
  • How to schedule shell tasks for a particular time with cron.

Happy Coding! 💃

Midnight-Blue Theme 😍

The Andela Way

A pool of thoughts from the brilliant people at Andela

Ikechi Michael

Written by

I’ve learned I don’t know anything. I've also learned that people will pay for what I know. Maybe that's why they never pay.

The Andela Way

A pool of thoughts from the brilliant people at Andela

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade