Skip to content

Instantly share code, notes, and snippets.

@starstuck
Last active January 24, 2019 09:32
Show Gist options
  • Save starstuck/ea77a844554ac370d1fb1e0f59d0b73e to your computer and use it in GitHub Desktop.
Save starstuck/ea77a844554ac370d1fb1e0f59d0b73e to your computer and use it in GitHub Desktop.
Install Slack black theme on macOS
#!/usr/bin/env bash
sudo mkdir -p /Library/Application\ Support/Slack/Resources
curl https://raw.githubusercontent.com/laCour/slack-night-mode/master/css/raw/black.css | sudo tee /Library/Application\ Support/Slack/Resources/black.css > /dev/null
sudo patch --backup /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js << EOF
*** ssb-interop.js
--- ssb-interop.js.patched
***************
*** 95,99 ****
const mainModule = require.resolve('../ssb/main.ts');
const isDevMode = loadSettings.devMode && isPrebuilt();
init(resourcePath, mainModule, !isDevMode);
}
--- 95,111 ----
const mainModule = require.resolve('../ssb/main.ts');
const isDevMode = loadSettings.devMode && isPrebuilt();
+ const fs = require('fs');
+ const blackCss = (() => {
+ try {
+ return fs.readFileSync('/Library/Application Support/Slack/Resources/black.css', { encoding: 'utf-8' });
+ } catch (err) {
+ return '';
+ }
+ })();
+ document.addEventListener('DOMContentLoaded', function() {
+ \$('<style></style>').appendTo('head').html(blackCss);
+ });
+
init(resourcePath, mainModule, !isDevMode);
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment