UPDATE: As of Slack 4.0, the methods below no longer work. I've had success using this: https://github.com/LanikSJ/slack-dark-mode
I recently got this from a co-worker and thought I would share. If you want a quick and easy way of implementing a dark theme in Slack, do the following:
On a Mac, navigate to this directory:
cd /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static
Edit the file ssb-interop.js
with a text editor.
Add this code to the very bottom (*edited thanks to amerritt14 for code support):
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://cdn.jsdelivr.net/gh/laCour/slack-night-mode/css/raw/black.css',
success: function(css) {
let overrides = `
code { background-color: #535353; color: #85c5ff; } /* Change color: to whatever font color you want */
.c-mrkdwn__pre, .c-mrkdwn__quote { background: #535353 !important; background-color: #535353 !important; }
`
$("<style></style>").appendTo('head').html(css + overrides);
}
});
});
Save the file and restart Slack, you should have a Dark theme!
Oldest comments (44)
This is awesome, thank you!
This is PHENOMENAL.
Any chance you know the location for Linux (Debian) machines?
Think this might work:
Linux: /usr/lib/slack/
Windows: %homepath%\AppData\Local\slack\
This works great on Windows, thanks!
Just a reminder: You will have to do this again after each Slack update, so keep this page bookmarked ;-)
Yeah 3.3.7 seems to have broken this hack.
This works great except in Slack threads.
In a thread the text entry field is white and text is a very light gray.
I see the same behaviour now, pretty sure this was not the case in the past. Wonder what changed.
A quick workaround is to add
.p-threads_footer__input .p-message_input_field { background: #000 };
to the CSS file.In case anyone wants to use - gist.githubusercontent.com/arunsat...
I've been looking for a working version of this for a long time. THANK YOU! 🔥
Some of the markup needs to be fixed.
'code' '''preformatted''' and >quote are all black on black backgrounds and you can't see them. I edited the above code to include:
Edited: fixed a typo in the code snippit.
Edited: found a way to also fix backgrounds for '''preformatted''' and >quote
You're the hero our office needed today for this. Where can I send a case of ramen?
code one-liner for repeated injection:
just paste in terminal and hit enter
sudo tee -a fix from sven
Hey fynn, I tried this command and got the following error:
-bash: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js: Permission denied
Any idea why?
well, sounds like you don't have the right permissions to edit that file.
just add
sudo
at the beginning of the one-liner (on a ctrl + a
gets you there).Should have said this in my original post, but
sudo
doesn't seem to help. I have admin permissions on this computer, though it's running Mojave and I'm not sure if that added any complications. I also dragged Terminal into "Full Disk Access" in Security & Privacy preferences just to be sure. Weird.well, admin permissions and sudo aren't really the same. some files have an extra layer of "protection".
what does
ls -la /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
say?Here's what I get:
-rw-r--r-- 1 root wheel 3806 Oct 22 09:03 /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
(I edited the file manually this morning to get it working)
yeah so the file belongs to the
root
user.. not you, meaning you have to usesudo
orchown
Just use
to fix your permission issues.
i have modified Fynn’s one liner to allow the script to be executed multiple times without adding the code more than once. If you place this script in an automator application on your mac, you can add it as a startup program so that it runs on boot.
edit: Implemented Wayne's jsdelivr modification, used absolute path to ssb-interop.js in sed command
I love this community
For the security conscious among us (or those on corporate networks that would kill us for including external code in a JS File in our slack), here's a version that inlines the contents of that file, and asks you for permission before updating so you can check out the "css" downloaded.
(I put "css" in quotes because there's a risk that the code could be compromised and not be CSS at all. Articles like this hackernoon.com/im-harvesting-credi... make me nervous about these types of attack vectors).
In any case: