Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/akalongman/slack


https://github.com/akalongman/slack

dark-theme slack

Last synced: 1 day ago
JSON representation

Awesome Lists containing this project

README

        

# Slack dark theme

In the file `/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js` add

```js
document.addEventListener("DOMContentLoaded", function() {

// Then get its webviews
let webviews = document.querySelectorAll(".TeamView webview");

// Fetch our CSS in parallel ahead of time
const cssPath = 'https://raw.githubusercontent.com/akalongman/slack/master/dark.css';
let cssPromise = fetch(cssPath).then(response => response.text());

// Insert a style tag into the wrapper view
cssPromise.then(css => {
let s = document.createElement('style');
s.type = 'text/css';
s.innerHTML = css;
document.head.appendChild(s);
});

// Wait for each webview to load
webviews.forEach(webview => {
webview.addEventListener('ipc-message', message => {
if (message.channel == 'didFinishLoading')
// Finally add the CSS into the webview
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);
})
});
});
});
```