camellia icon indicating copy to clipboard operation
camellia copied to clipboard

Automatic background brightness adjustment

Open flaksp opened this issue 2 years ago • 0 comments

This feature allows us to automatically manage contrast of background image.

This PR is temporally blocked. To detect image brightness, we need to analyse an image with JavaScript (we load image into canvas with ctx.drawImage()). CORS is enabled on all sites by default to protect resources (such as images, APIs, etc) and website developers have to manually opt-in to allow cross-origin requests. It's safe to say that most websites do not allow cross-origin requests. We even can't catch CORS errors in our code with try/catch, so implementation of this feature is not possible yet.

The only way to ignore CORS requirements is to receive *://*/* permission. We don't want to declare this permission as required one, because it's not mandatory for the app to work. It's just about UI and accessibility improvements, that's why we should make this permission optional. Managing optional permissions is out of scope of the initial 2.0 release, that's why I will hold this PR for the future. Optional permission management feature will be required for some future planned features, I hope I will finish this PR some day.

Also:

  • https://stackoverflow.com/questions/37986669/auto-adjust-brightness-contrast-to-read-text-from-images

flaksp avatar Apr 23 '22 19:04 flaksp