Jelmerro / Vieb

Vim Inspired Electron Browser - Vim bindings for the web by design
https://vieb.dev
GNU General Public License v3.0
1.32k stars 65 forks source link

switch darkreadermode #451

Closed se7en-x230 closed 1 year ago

se7en-x230 commented 1 year ago

nmap <C-.> <:set darkreadermode=light> nmap <C-,> <:set darkreadermode=dark>

dark to light works light back to dark takes several times till it switches. test site was google.com

Is my approach faulty?

Jelmerro commented 1 year ago

It seems to work here, did you try the commands separately without the mapping? And does it also break on other sites when switching?

se7en-x230 commented 1 year ago

manual or automated make no different.

nmap <C-.> <:set darkreadermode=light><refreshTab> nmap <C-,> <:set darkreadermode=dark><refreshTab>

Other sites like bing.com not change at all.

set darkreader=true set darkreaderblocklist="^(?!.github.)" set darkreadergrayscale=100 set nativetheme=dark

Jelmerro commented 1 year ago

If you do :set nativethem=light when switching to the light theme, does that help, or not at all?

se7en-x230 commented 1 year ago

I moved .config/Vieb out of the way to start with all defaults. Only setting in my viebrc is set darkreader=true

I can switch manual :set darkreadermode=dark/light and automatically as long as I do NOT enable darkreaderblocklist once that is anabled I am not able to use the set command or the keybindings.

Only trouble I have is that switching back to light will keep some fields dark.

image

EDIT: It looks like darkreader=true is completely ignored once I set darkreaderblocklist

EDIT2: In fact the once I set darkreaderblocklist github the ONLY site that changes is github :)

Jelmerro commented 1 year ago

This is because you have added a inverted pattern to the blocklists, meaning it will be used as an allowlist. You can do :set darkreaderblocklist=github.com not the inverted pattern, as this will match everything EXCEPT github, meaning it will block everything from using darkreader besides github. This is working as intended, please let me know if you have other questions, I should probably make this more clear in the help.

se7en-x230 commented 1 year ago

Oh wow ... do I feel stupid now :) Setting the darkreaderblocklist correct works obviously.

Okey but I still have one question. Why does :set darkreadermode=light not return to the original page design (see google.com screenshot) but keeps see upper part dark?

se7en-x230 commented 1 year ago

Wouldn't it be easier to have

nmap <C-.> <:set darkreader=false> nmap <C-,> <:set darkreader=true>

to switch darkreader all together on and off?

Jelmerro commented 1 year ago

The light theme of darkreader isn't perfect sadly, but this is not a Vieb issue. It's more of a dimmed theme, and they mentioned that a perfect light theme is not the focus of the project. Since many pages default to white, it would indeed be an option to toggle darkreader completely instead of toggling the light/dark version.