Skip to content

svendhhh/slack-night-mode

 
 

Repository files navigation

Slack Night Mode

A user style for easy Slack theming. CC0.

Usage

Our instructions

Windows Desktop App 4.0

  1. Make sure you have NPM installed or install it (https://blog.teamtreehouse.com/install-node-js-npm-windows)

  2. Make sure your slack are on the latest version (4.0.2)

  3. Quit Slack (make sure it's not still running in the System Tray)

  4. Open Command prompt, navigate to %localappdata%/slack/app-4.0.2/resources/

  5. Install npx with npm install -g npx

  6. Install Asar with npm install -g asar

  7. Unpack the app.asar with the command: npx asar extract app.asar app.asar.unpacked

  8. Insert the below code at the end of in the unpacked file ssb-interop.bundle.js Note: It may look like mumbo-jumbo in the file, but it's just minified javascript - do not despair.

  9. Repack the asar file: npx asar pack app.asar.unpacked app.asar

document.addEventListener("DOMContentLoaded", function() {
    let webviews = document.querySelectorAll(".TeamView webview");
    const cssPath = 'https://raw.githubusercontent.com/svendhhh/slack-night-mode/master/css/raw/black.css';
    let cssPromise = fetch(cssPath).then(response => response.text());
    cssPromise.then(css => {
       let s = document.createElement('style');
       s.type = 'text/css';
       s.innerHTML = css;
       document.head.appendChild(s);
    });    
    webviews.forEach(webview => {
       webview.addEventListener('ipc-message', message => {
          if (message.channel == 'didFinishLoading')       
             cssPromise.then(css => {
                let script = `
                      let s = document.createElement('style');
                      s.type = 'text/css';
                      s.id = 'slack-custom-css';
                      s.innerHTML = \`${css}\`;
                      document.head.appendChild(s);
                      `
                webview.executeJavaScript(script);
             })
       });
    });
 });

Original Readmy from laCour's project:

Browser

This theme requires that you use a user styles extension for your browser, such as Stylus (available for Firefox, Chrome, and Opera).

Desktop App

No official support. Workarounds exist.

🛑 READ FIRST: Most workarounds will request the compiled CSS file from this repository. You are strongly discouraged from using a remote CSS file. It's recommended that you create your own copy. An XSS attack could put your Slack client at risk.

Chat on Gitter (previous discussion)

Themes

Supported

Black (source - build - install)

The primary supported theme. This is an excellent theme if you use a program like f.lux or redshift.

Black Screenshot

Aubergine (source - build - install)

This is based on Slack's aubergine/maroon style. It's the original theme.

Aubergine Screenshot

Variants

Extensions

Variants can have extensions which add additional changes.

Monospaced (source)

Replaces the messaging font stack with a monospace font stack.

About

A Stylus style for easy Slack theming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 100.0%