So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!
Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.
But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.
Prerequisite Your custom CSS needs to be hosted somewhere accessible over HTTP. For a free option, you can use a Gist and use the link to the raw file.
- Open up
Slack.app
, and navigate to any message; - In the message input field, enter
/macgap.app.enabledevelopertools()
, and press enter - Right click any element in the app (except the team switcher on the left), and choose
Inspect Element
- Open the
Console
tab - Run the following snippet of JavaScript in your console, replacing the value of
cssURI
with the URI that points to your custom stylesheet.
// Using ajax rather than a dynamically injected <link>, to account for sites (like gist.github.com) that don't serve
// a content-type for CSS files
var cssURI = 'https://gist.githubusercontent.com/DrewML/f244d6015c9b690b1dc241669b69dde1/raw/3d6351b8767ee5fba1ac86cad9b8cc5cf2ff9fea/slack-theme.css';
$.get(cssURI).then(function(css) {
$('<style />').text(css).appendTo('body')
});
If you know the basics of CSS and browser developer tools, writing a theme should be a breeze. You can either use the Developer Tools exposed in the Slack
application itself, or you can visit https://{myteamhere}.slack.com/messages
and use the browser dev tools of your choosing.
Because you're just injecting styles in the DOM, this means that your changes do not persist when you exit and re-open the application. However, the Developer Tools will remember the last code you executed, so it should be a few keystrokes to open the panel and re-run your injection script.
I don't have root nor sudo access on my Mac, so the solutions that involve editing a
*.js
file in/Applications/Slack.app/Contents/Resources/
aren't options for me.Can someone please tell me is there any other option (that is known to be currently working)? I have the Slack app (Version 3.1.0) on my Mac. I went through the 5 steps in this
Theming-Slack-OSX.md
file (for step2.
I used the workaround described by this comment. As you can see by the following screenshot, for the most part Slack looks good, except the name of the room is missing (where I have the red arrow pointing to the circled area).And more importantly than the room name being invisible in that one spot, I'd be all ears if anyone has any ideas how I can automate this (so the dark theme remains in place even after re-starting the Slack app on my Mac).
Any suggestions would be greatly appreciated. thank you!
UPDATE: fyi a co-worker helped me solve this:
I created the following on my Mac (so this env var is always exported)...:
...though it turns out that isn't needed, because I don't need to do step
3.
after all, because I found a way to edit a Slack*.js
file:Before I gave up when it looked like only root can edit the file:
But I opened
Finder
, clickedApplications
, right-clickSlack
,Show Package Contents
, browse toContents/Resources/app.asar.unpacked/src/static/
and then I edited thessb-interop.js
file.I copied the code from https://github.com/widget-/slack-black-theme/blob/master/readme.md into that
ssb-interop.js
file. (Those instructions (from thatreadme.md
) are for version2.5.1
, but I found with Slack version3.1.0
thatssb-interop.js
is actually the file that needs to be edited.) And in the "cdn.rawgit.com
" URL I changed "/widget-/
" to "/ViktorQvarfordt/
", because personally I like that slightly differentcss
better.