simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.05k stars 133 forks source link

Broken colors in some themes #146

Closed duongdominhchau closed 1 year ago

duongdominhchau commented 3 years ago

Hi, today I use this extension again after a long time and notice that the text color is broken for some themes, specifically they are:

Other themes may not have the border, but they work fine, like GitHub Dark: image

Environment

simov commented 3 years ago

Interesting, are you using dark mode in FF or in your OS? I guess those css styles are picking this up somehow.

duongdominhchau commented 3 years ago

I set all of them to use dark theme. I inspected the source of that color and Firefox shows that it comes from resource://content-accessible/plaintext.css. This is the whole file:

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  -moz-control-character-visibility: visible;
}

.nowrap pre {
  white-space: pre;
}

/* Make text go with the rules of dir=auto, but allow it to be overriden if 'Switch Text Direction' is triggered */
html:not([dir]) pre { /* Not a UA sheet, so doesn't use :-moz-has-dir-attr */
  unicode-bidi: plaintext;
}

@-moz-document unobservable-document() {
  @media (prefers-color-scheme: dark) {
    :root {
      /* in-content-page-{color, background} for dark theme. */
      background: rgb(28,27,34);
      color: rgb(251,251,254);
    }

    @media not (-moz-proton) {
      :root {
        background: #2a2a2e;
        color: rgb(249, 249, 250);
      }
    } /** END !proton **/
  }
}

/* NOTE(emilio): For some reason some pages, mainly bing.com, load a bunch of
 * scripts in zero-size <object> elements, see bug 1548449.
 *
 * Line-breaking such documents is useless and pretty expensive, so only render
 * them if there's a viewport. Sigh.
 */
@media (width: 0) or (height: 0) {
  :root {
    display: none;
  }
}

I tried disabling this extension and refresh, the link to that file is still there. I tried switching to other Firefox themes like the Default and the Light theme, all of them have this problem, so this CSS is not injected by the Firefox theme. I suspect my other extensions so I also disable them all, but the CSS is still injected. I'm out of clue for now.

By the way, should I report things like this? I notice that sometimes Firefox Developer Edition has breaking change in one version and get reverted in the next version, then get re-added again in another next version.

simov commented 1 year ago

Markdown Viewer v5 now comes with 30 new themes, you can download it from the Chrome Web Store or the releases section here, I hope you find a theme that you like. All of them are looking really great and some of them support auto dark mode as well.