question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal - dim images with opacity

See original GitHub issue

What is the Proposal?

Add dimming to images.

Why?

When browsing the web at night, often times you’ll run into images that have white or very bright backgrounds and are not png’s. Imagine browsing websites (example e-commerce/shopping) where they use large white backgrounds.

ImageJoiner-2019-11-17 at 12 37 06 PM

Solution

  • Dim images slightly.
  • Add a configurable option to toggle this feature on/off.

demo

Potential Challenges

  • jpg’s or images that don’t have bright backgrounds could become hard to read. I haven’t dug into how to solve that issue too much, but I know there are micro javascript libraries that can detect the color of images and analyze the brightness level, if we were to use something like that, we could check the brightness of the image after loading the page, to undo dimming, if the image doesn’t need to be dimmed.

CSS filters have strong support already. Most users who use dark reader, we can assume are on relatively newer browsers. If they know how to install an extension and find one like dark reader, we can make some assumptions =).

img {
	border-color: #000;
	box-shadow: none;
	-webkit-filter: brightness(0.8) contrast(1.2);
	filter: brightness(0.8) contrast(1.2);
}

Live demo code (JSbin.com): https://jsbin.com/naseresade/4/edit?html,output

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:5

github_iconTop GitHub Comments

6reactions
vyach-vasilievcommented, Sep 8, 2020

Yes! Indeed, this stunning extension has saved my eyes more than once by nights! It would be great to have this functionality, albeit as an implicit setting.

In the meantime, I am using such a simple code that I pasted into the config editor.

img, video {
    filter: brightness(0.5);
}
img:hover, video:hover {
    filter: unset;
}

Hovering over an element returns the brightness so that you can better understand the context 👍

1reaction
WebMechaniccommented, Jan 26, 2020

this is a new way to waste CPU cycles and other resources.

so are browser extensions 😉

Actually CSS filters run on the GPU.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I give text or an image a transparent background ...
No transparent PNG images are required. Use :before (or :after ) in CSS and give them the opacity value to leave the element...
Read more >
How to use transparency in graphic design - Canva
In this article, we deep dive into a core design principle: Transparency. ... You could create depth by using a more transparent photo...
Read more >
11 Design Tips to Make Text Over Images More Readable
The image in the background is such that if some part of it is blocked by text and transparent shape, the slide becomes...
Read more >
Deep Image Matting. The tech behind EraseBG - Rahul Deora
Both these images are input to the DIM model. The third and fourth columns are the predicted alpha mattes of a classical method,...
Read more >
Deep Image Matting - arXiv
cently proposed deep learning methods are highly reliant on ... learn an alpha matte end-to-end given an image and trimap.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found