Skip to content

bug: Sites that assume a white background are illegible with agregore dark mode #318

@RangerMauve

Description

@RangerMauve

Sites like this one assume that browsers will default to a white background and set a dark font color in their CSS which then becomes illegible. I find a lot of these sites break reader mode in some weird way on top of everything else. 😅

We should detect this case and fix it.

The logic should get injected on page load (maybe in the renderer extension? maybe an electron preload? part of the hasStyles check?)

It should look something like this:

const {backgroundColor, color: rootColor} = getComputedStyle(document.body.parentElement)
if(backgroundColor === 'rgba(0, 0, 0, 0)') {
  const {color} = getComputedStyle(document.querySelector('p,span') || document.body))
  if(color === rootColor) {
    // They didn't set a font color at all
    // Inject the agregore styles into the page
  } else {
    // They set a color but assumed a white background
    // Set the body background to `#F2F2F2`
  }
}

Then we should test some styles of these pages to see if it breaks. Setting the background on the body will allow for the fancy page background effects on Windows and MacOS

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions