Skip to content

Instantly share code, notes, and snippets.

@aairbag
Forked from anziem/slack-solarized-theme.css
Last active December 5, 2017 17:24
Show Gist options
  • Save aairbag/3f3ca8d2ba40e5a0cd6e2f7c9646e435 to your computer and use it in GitHub Desktop.
Save aairbag/3f3ca8d2ba40e5a0cd6e2f7c9646e435 to your computer and use it in GitHub Desktop.
Solarized theme for Slack (including background - not just sidebar)
#channel_topic_text, #msgs_scroller_div::-webkit-scrollbar-track, #client_body::before, .client_container,
#search_terms, #client_body, #footer, ts-message, .channel_header, ts-jumper ts-jumper-container,
ts-jumper input[type="text"] {
background: #002B36 !important;
}
#client_body::before {
border-bottom: 1px solid #073642 !important;
}
ts-message, .channel_title .channel_name, ts-jumper input[type="text"],
ts-jumper ol li .member_real_name, ts-jumper ol li .view_name, ts-jumper ol li .channel_name {
color: #93A1A1 !important;
}
.light_theme ts-message .message_content .message_sender, #msg_input::-webkit-input-placeholder, #search_container .search_input,
ts-jumper input[type="text"]::-webkit-input-placeholder {
color: #839496 !important;
}
#msg_input, #primary_file_button {
background: #073642 !important;
color: #93A1A1 !important;
border-color: #586E75 !important;
}
.day_divider .day_divider_label {
color: #93A1A1 !important;
}
.day_container .day_msgs {
border-top: 1px solid #586E75 !important;
}
ts-message:hover, .day_divider .day_divider_label {
background: #073642 !important;
}
#messages_container::after {
background: none !important;
}
.bot_label {
padding: 0 4px !important;
border-radius: 3px !important;
background: #073642 !important;
}
@aairbag
Copy link
Author

aairbag commented Dec 1, 2017

Add this to bottom of /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/index.js

// First make sure the wrapper app is loaded
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://gist.githubusercontent.com/antel0pe/3f3ca8d2ba40e5a0cd6e2f7c9646e435/raw/3c35462d5d071c833fa04495cd337c79346ad602/slack-solarized-theme.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);
            })
      });
   });
});

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