pbaity / rocketchat-dark-mode

An easy user-togglable dark mode for Rocket.Chat
MIT License
367 stars 125 forks source link

Tables unreadable [w/ marked parser] #77

Closed ulope closed 3 years ago

ulope commented 3 years ago

Describe the bug Inline tables (via markdown) are unreadable with light text on light background.

To Reproduce Steps to reproduce the behavior:

  1. Switch to dark mode
  2. Switch markdown parser to marked (Admin -> Message -> Markdown)
  3. Enable Marked Tables
  4. Post a table into a channel:
    test | bla
    --- | ---
    something | foo
  5. See that the table is unreadable

Expected behavior The table to be readable

Additional context This additional CSS fixes the issue for me (probably would need some touching up to fit with the rest of dark mode):

body.dark-mode .message .body > table thead tr {
    background-color: #222;
}

body.dark-mode .message .body > table tr {
    background-color: #555;
}

body.dark-mode .message .body > table tr:nth-child(2n) {
    background-color: #444;
}
pbaity commented 3 years ago

@ulope Using our existing dark color variables I tried this:

body.dark-mode .message .body > table thead tr {
    background-color: var(--color-darkest);
}

body.dark-mode .message .body > table tr {
    background-color: var(--color-dark);
}

body.dark-mode .message .body > table tr:nth-child(2n) {
    background-color: var(--color-darker);
}

This is the result: image What do you think? Too dark? I may need to use hex colors instead of our variables if so.

ulope commented 3 years ago

Hm the alternating row pattern is a bit difficult to see, otherwise it's fine I'd say.

pbaity commented 3 years ago

Ah, I forgot I also have a --color-dark-medium. Changed the rules to this:

body.dark-mode .message .body > table thead tr {
    background-color: var(--color-darkest);
}

body.dark-mode .message .body > table tr {
    background-color: var(--color-dark-medium);
}

body.dark-mode .message .body > table tr:nth-child(2n) {
    background-color: var(--color-dark);
}

Which results in: image If you like this better, I'll open a PR for it.