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.

[enhancement]: Consider allowing external extensions to toggle theme.

See original GitHub issue

I’d like to do some automation with dark reader, but I’ve found that external connections (using chrome.runtime.sendMessage) aren’t handled.

Something like this in the constructor of Messenger:

chrome.runtime.onConnectExternal.addListener(function(port) {
  if (port.name === 'ui' && port.type === 'toggle-current-site') {
    port.onMessage.addListener(function() {
      this.adapter.toggleCurrentSite();
    });
  }
});

and this line to the getMessengerAdapter method in extension.ts:

toggleCurrentSite: () => this.toggleCurrentSite(),

Should be enough to allow this in other extensions:

chrome.runtime.sendMessage('eimadpbcbfnmbkopoojfekhnkhdbieeh', {name: 'ui', type:' toggle-current-site'});

Happy to add a pull request if this is considered worth adding.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Gustedcommented, Apr 29, 2021

Maybe a simpler version using onMessageExternal API: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessageExternal

The current version is simple-as-is without possessing any security treat from external possible bad actors. See #3519

1reaction
voldemortensencommented, Aug 28, 2018

That’s a great suggestion, but still doesn’t provide a solution. I can control the screen brightness in a variety of ways. I can’t, however, use my browser to use a dark theme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Chrome with accessibility extensions - Google Support
Find & add accessibility extensions · Use Google's accessibility extensions · Caret Browsing (navigate using your keyboard) · Color Enhancer (adjust webpage colors)....
Read more >
May 2022 (version 1.68) - Visual Studio Code
This milestone we added a new capability for users to toggle the view mode of the ... In this case, VS Code does...
Read more >
How to Make Sure Your Browser Extensions Are Safe - WIRED
The toggle switches let you enable and disable extensions without actually removing them—you can get rid of them by clicking Remove and then ......
Read more >
A Complete Guide to Dark Mode on the Web - CSS-Tricks
Or, even if you're starting from scratch, you'll have both themes: light and dark. One theme should be defined as the default that...
Read more >
Install Power Automate browser extensions - Microsoft Learn
Search for the prompts.tab_modal.enabled preference in the list and change it to false. Configure Internet Explorer. By default, Internet ...
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