Skip to content

Instantly share code, notes, and snippets.

@jonathanlaf
Last active November 2, 2023 17:19
Show Gist options
  • Save jonathanlaf/91c52daa07f12ec987952d7c6697dd9c to your computer and use it in GitHub Desktop.
Save jonathanlaf/91c52daa07f12ec987952d7c6697dd9c to your computer and use it in GitHub Desktop.
[Dark Slack] How to hack Slack to get a dark theme #slack #css #hack

🔥 How to "Hack" Slack to get a dark theme. 🔥

Slack Dark Theme

❗ Close Slack if it's running ❗

Installing theme

In your favorite text editor, open the following file :

  • Windows C:\Users\<USERNAME>\AppData\Local\slack\app-<VERSION>\resources\app.asar.unpacked\src\static\ssb-interop.js
  • macOS Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
    • (To open Slack.app, right click on Slack app icon and click on Show Package Contents)
  • Linux (tested on Fedora) /usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js

and add the following line at the end of the openned file :

document.addEventListener('DOMContentLoaded', function() {
    $.ajax({
        url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css',
        success: function(css) {
            $("<style></style>").appendTo('head').html(css);
        }
    });
});

Sidebar colors

To make your sidebar fit your new colors, you can specify directly in your preferences your sidebar colors! From your slack app, go to hamburger menu, then click Files > Preferences > Sidebar > Theme > Custom Theme then copy paste the following : #363636,#444A47,#D39B46,#FFFFFF,#434745,#FFFFFF,#99D04A,#DB6668

Sidebar Dark Colors

VOILA! Open slack and Enjoy! 💪

@krazyito65
Copy link

krazyito65 commented Jul 15, 2019

https://dev.to/mykeels/why-is-slack-changing-its-internals-4p4c -- well this is sad..

With the recent release of v4.0, the file is gone, and exists as a bundled file within app.asar, a compressed file.

To achieve the same functionality, you'd have to extract app.asar into a folder, edit the dist/ssb-interop.bundle.js file, and compress the folder back into app.asar before restarting the application.`

@BluePhoenix
Copy link

BluePhoenix commented Jul 16, 2019

This is sad indeed... found a page that breaks down the steps a bit, but I still haven't had time to try them myself.

Likely way to patch Slack to include dark mode after the changes in 4.0.0+:
https://qiita.com/shoken/items/4f0bbba9b5d911657b5a

@vuphanq
Copy link

vuphanq commented Jul 16, 2019

It works!! For Mac, you need to install Homebrew and NPM first if they have not been installed yet.
https://brew.sh/
https://treehouse.github.io/installation-guides/mac/node-mac.html

@Cronocide
Copy link

Following this guide in conjunction with the code above worked for me.
https://qiita.com/shoken/items/4f0bbba9b5d911657b5a
I did have to run sudo xattr -cr /Applications/Slack.app/ between steps 6 and 7 though.

@mikey-t
Copy link

mikey-t commented Aug 1, 2019

I wrote a shell script to automate the unpacking/injecting/packing for Slack 4 if anyone is interested. You can replace my css file with another if you have some CSS you like. https://github.com/mikey-t/slack-dark-theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment