-
Notifications
You must be signed in to change notification settings - Fork 403
Had to add some additional css today #48
Comments
I had the same issue this morning, thanks for the fix |
Thanks, my text was still a weird color tho, so I added this:
|
@eedeep so Slack on my Mac just updated to 3.1.1. In the past, I've followed these instructions and placed the code in the bottom of the index.js file every time Slack has updated. But with this update I'm still getting a default, white background in the chat pane. I tried adding your above code to the bottom of ssb-interop.js but I'm still not seeing any dark theme changes take place. I'm not a developer, so please forgive me for being ignorant on how to fix this on my own. |
Similarly I'd really appreciate a quick "do this, to this file, do this, to this file...." if possible please. |
This is my setup using a different styling, but you can replace with parts from this repository. 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://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css';
let cssPromise = fetch(cssPath).then(response => response.text());
let customCustomCSS = `
:root {
/* Modify these to change your theme colors: */
--primary: #61AFEF;
--text: #00b200;
}
div.c-message.c-message--light.c-message--hover
{
color: #00b200 !important;
}
span.c-message__body,
a.c-message__sender_link,
span.c-message_attachment__media_trigger.c-message_attachment__media_trigger--caption,
div.p-message_pane__foreword__description span
{
color: #00b200 !important;
font-family: "Fira Code", Arial, Helvetica, sans-serif;
text-rendering: optimizeLegibility;
font-size: 14px;
letter-spacing: -0.6px !important;
}
div.c-virtual_list__scroll_container {
background-color: #080808 !important;
}
.p-message_pane .c-message_list:not(.c-virtual_list--scrollbar), .p-message_pane .c-message_list.c-virtual_list--scrollbar > .c-scrollbar__hider {
z-index: 0;
}
div.c-message__content:hover {
background-color: #080808 !important;
}
div.c-message:hover {
background-color: #080808 !important;
}
`
// Insert a style tag into the wrapper view
cssPromise.then(css => {
let s = document.createElement('style');
s.type = 'text/css';
s.innerHTML = css + customCustomCSS;
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 + customCustomCSS}\`;
document.head.appendChild(s);
`
webview.executeJavaScript(script);
})
});
});
}); |
Thanks @odedelharar your code pasted in & worked first time. Just need to change that green. ;-) |
@odedelharar thank you so much!! Problem solved! |
This is my extended One Dark style: let customCustomCSS = `
:root {
/* Modify these to change your theme colors: */
--primary: #61AFEF;
--text: #ABB2BF;
--background: #282C34;
--background-elevated: #3B4048;
}
pre.special_formatting
{
background-color: #282C34 !important;
color: #8f8f8f !important;
border: solid;
border-width: 1px !important;
}
#im_browser .im_browser_row,
.c-message_list__day_divider__line,
.p-threads_view__divider_line
{
border-top: 1px solid #afafaf !important;
}
div.c-message.c-message--light.c-message--hover,
#file_preview_scroller .texty_comment_input,
.c-message.c-message--light.c-message--hover.c-message--adjacent.c-message--last
{
color: #fff !important;
background-color: #3B4048 !important;
}
#file_preview_scroller .message_sender,
#file_preview_scroller .file_viewer_link,
#file_preview_scroller .comment_body,
#file_preview_scroller .ts_tip_btn,
#file_preview_scroller .file_comment_tip,
#file_preview_scroller .file_meta,
#file_preview_scroller .file_ssb_download_link,
.c-member--medium,
.c-member__display-name,
.c-member__secondary-name--medium,
.c-team__display-name,
.c-usergroup__handle,
.c-message_attachment,
.c-message_attachment__pretext,
.c-message_attachment__button,
.c-message_attachment__select,
.c-message_list__day_divider__label,
.c-message_kit__background,
.c-icon--channel,
.c-channel_name__text,
.c-file__title,
.c-file__meta,
.c-reaction__count,
.c-reaction_add__icon--fg,
.c-input_select_options_list__option,
.c-input_select_options_list_container:not(.c-input_select_options_list_container--always-open),
.p-thread_participant_list,
.p-threads_view__divider_label,
span.c-message__body,
a.c-message__sender_link,
div.c-message_attachment__row,
div.p-message_pane__foreword__description span,
ts-conversation.message_container ts-message .message_content .message_sender,
span.c-message_attachment__media_trigger.c-message_attachment__media_trigger--caption
{
color: #afafaf !important;
}
.c-reaction_add__icon--bg
{
color: #282C34 !important;
}
div.c-virtual_list__scroll_container,
div.c-message:hover,
.c-file_container,
.c-file__slide--meta,
.c-reaction,
.c-reaction_add,
.c-message_list__day_divider__label__pill,
.c-button--outline,
.c-message_attachment__button,
.c-message_attachment__select,
.p-threads_view__divider_label,
.c-input_select_options_list_container:not(.c-input_select_options_list_container--always-open),
#im_browser #im_list_container:not(.keyboard_active).not_scrolling .im_browser_row:not(.disabled_dm):hover
{
background-color: #282C34 !important;
}
.c-message_kit__background,
.p-threads_view__footer,
.p-threads_view_root {
border: 1px solid #3B4048;
}
.c-file__icon:after
{
border: 3px solid #282C34;
}
.c-button--outline,
.c-message_attachment__button,
.c-message_attachment__select,
.c-file_container,
.c-reaction,
.c-reaction_add,
.c-input_select_options_list_container:not(.c-input_select_options_list_container--always-open)
{
border: 1px solid;
border-color: #3B4048;
}
.c-file_container:hover,
.c-reaction:focus,
.c-reaction:hover,
.c-reaction_add:focus,
.c-reaction_add:hover
{
border-color: #afafaf;
}
.c-file_container--has_thumb .c-file__actions:before
{
background-image: linear-gradient(90deg,hsla(0,0%,100%,0),#282C34 20px);
}
.c-member_slug--link,
.c-message_kit__hover--hovered
{
background: #3B4048;
}
.c-member_slug--link:hover,
.c-message_kit__background,
.p-threads_view__footer
{
background: #25272a;
}
.p-message_pane .c-message_list:not(.c-virtual_list--scrollbar),
.p-message_pane .c-message_list.c-virtual_list--scrollbar > .c-scrollbar__hider {
z-index: 0;
}
`; |
Above suggestions did not work for me, but I was able to restore my previous theme just by adding a single simple CSS rule-set: .c-message, .c-virtual_list__item {
background-color: #222 !important;
} Here is the complete code that I add to a fresh The instructions are simply:
// 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://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css';
let cssPromise = fetch(cssPath).then(response => response.text());
let customCustomCSS = `
:root {
/* Modify these to change your theme colors: */
--primary: #61AFEF;
--text: #ABB2BF;
--background: #282C34;
--background-elevated: #3B4048;
}
div.c-message.c-message--light.c-message--hover {
color: #fff !important;
background-color: #222 !important;
}
span.c-message__body,
a.c-message__sender_link,
span.c-message_attachment__media_trigger.c-message_attachment__media_trigger--caption,
div.p-message_pane__foreword__description span {
color: #afafaf !important;
}
pre.special_formatting {
background-color: #222 !important;
color: #8f8f8f !important;
border: solid;
border-width: 1 px !important;
}
.c-message, .c-virtual_list__item {
background-color: #222 !important;
}
`
// Insert a style tag into the wrapper view
cssPromise.then(css => {
let s = document.createElement('style');
s.type = 'text/css';
s.innerHTML = css + customCustomCSS;
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 + customCustomCSS}\`;
document.head.appendChild(s);
`
webview.executeJavaScript(script);
})
});
});
}); Incidentally, you can also make this easier to re-apply whenever Slack updates by placing the above code in a file on your hard drive ( alias slackdark='cat ~/slack_dark_theme.js >> /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js' Then you just need to type |
Apply bug-fixes as described in https://github.com/widget-/slack-black-theme/issues/48
I'm using the code from @mliq (thanks!) - how to get rid of the white 'mention' names and 'yesterday' text: |
@dhowe The CSS in my comment above solves a lot of those issues. I've been going through updating it as and when I find something to restyle. Hope it's helpful :) |
@odedelharar your code works great, and I was finally able to use it to specify a serif font! However, my messages bar is still the default purple instead of a darker theme color. Am I missing something or did you not change that color? How can I make it match the rest of the dark theme? |
How are you guys determining the classes, does it just match up with what's in the web browser or are you forcing inspector into the code? |
@ctsstc it matches the web browser classes. |
@richardcane solution worked perfectly @mliq your solution was having an issue with link preview text matching the background color. |
I used this at the bottom of my css to get rid of the white bar: .p-message_pane .c-message_list:not(.c-virtual_list--scrollbar), #client_body:not(.onboarding):not(.feature_global_nav_layout):before { |
@acdifran I used your code above and it almost totally got rid of the white. As you can see in the screenshot below, though, I still have a tiny sliver of white that's present on the left of that element. I even tried adding just a left border of #222 but instead of replacing the white sliver, it just pushed it over next to the left border. Any idea how to fix this? |
Yeah, I actually fixed that too, but just forgot to update my original comment to fix a mistake. You just need to add "!important" to the border like: #client_body:not(.onboarding):not(.feature_global_nav_layout):before { |
So that solves the issue almost completely except when on the All Threads pane. When I go to the "All Threads", the little sliver of white is still there. This picture above is with your code applied. All that border-left code does is move the white sliver over. Below is a screenshot of it when I set the border-left to 250px just to test it. As you can see, all it did was push the white sliver over to the right by 250px. I'm not really sure what to do about it. To reiterate, this white piece is now only visible on the "All Threads" pane, nowhere else. |
Yeah I see that now, didn't notice it before. Just need to add this line "box-shadow: none !important;" to the same section like this: #client_body:not(.onboarding):not(.feature_global_nav_layout):before { |
@acdifran that fixed it! Thank you so much!! |
No problem! Glad it's working :) |
For anyone else annoyed with the white flash while changing channels, add:
|
Here is an updated version of @mliq code with some improvements.
-- fixed for version 3.3.1
|
Confirmed that it's unnecessary to modify @leoandreotti's latest code block works great. I've made two changes locally:
Thanks everyone for this work! |
@veekas thank you for your comment. I was looking for your addition this morning. About your removal, please note that when you expand the messages actions ... you will see one option with the #222 background, that is wht I’ve placed that :not. Will look for another alternative. |
@leoandreotti I too had some trouble finding the fix for that. Thanks in advance to whoever figures that one out! Same for the |
@veekas For the :not I am using now:
|
Thanks to everyone so far for the help with my css. I do have a question for everyone. TLDR; I need help changing which image url one particular emoji/reaction uses with custom css in the ssb-interop.js file. I'm the only one in my department where I work that uses dark mode for Slack. And my coworkers use the "heavy_check_mark" a lot. For some reason, while I'm not using the dark mode in Slack, that check mark is green and very easy to see. But while I'm using dark mode, the check mark turns to a dark gray. It has a transparent background and because of that, it's low contrast and hard to see because it's gray on gray. That's what it looks like on my screen. It's kind of hard to see. Below is the element of that heavy check mark:
Once again, this is only a problem for me since I'm using the dark mode. Do you guys know if it's possible for me to modify the css of just that emoji reaction in my Slack to use a different image url? I don't really know css at all. The span,
I know that obviously, that's not the right syntax at all. Like I said, I don't know what I'm doing. But maybe one of you guys know how to do this? I couldn't find what I needed while searching Google. Any help is appreciated, thanks! |
@hiteshkr thank you! both your codes work great!!! |
Hi Guys, using @leoandreotti 's latest script. I dont want the scrollbar to overlap the selection of channel Thx :) |
@leoandreotti can you please create a repo for your code? I am using it and it's really useful. I want to be able to follow changes and get them easily without having to get piecemeal changes from other people's comments. I don't mind doing it if you don't want to keep up the repo and deal with prs, but I figure since it's your code you should be the one to do it. |
@jgerstle Hi Jeremy, I can do it. I will try to do it this weekend. Thank you! |
thanks everyone for the amazing work above Can we also get a fix for the reply to a thread white box? |
Hi @dvanlunen, can you provide a screenshot of where you see that box? I can try to fix that in my fork of the project. |
Hi @dvanlunen, I have been able to fix that on my fork of this project at https://github.com/leoandreotti/slack-dark-theme |
I added this to the local config file to make the Threads font color dark enough to see in the conversations tab.
|
Just updated my styling again, threading looks alright now. |
It seems that starting from today, I suddenly had to add in these extra bits of CSS to my ssb-interop.js other wise a bunch of stuff (chiefly the background of the main messages pane) in the slack UI (this is on 3.1.1 of the desktop app on ubuntu) was no longer dark:
Just an FYI more than an issue per se.
The text was updated successfully, but these errors were encountered: