re: Easy Dark Mode for Slack VIEW POST

FULL DISCUSSION
 

I apologize if this is a trivial question since I know essentially no JS, but how would you modify the added js above in order to read the .css from a local file. the example works great for me, but it doesn't work if I try various paths for replacing the 'url between the single quotes'

 

This will work for you. Again, put it at the end of the ssb-interop.js file. If you are running on Windows, use the forward slash and start the path with 'C:/' :

document.addEventListener('DOMContentLoaded', function() {
var fs = require('fs'),
filePath = '/Applications/Slack.app/Contents/Resources/black-slack.css';

fs.readFile(filePath, {encoding: 'utf-8'}, function(err, data) {
if (!err) {
var css = document.createElement('style')
css.innerText = data;
document.getElementsByTagName('head')[0].appendChild(css);
}
})
});

code of conduct - report abuse