Paste number 105738: toggle-dark-mode for conkeror

Index of paste annotations: 1

Paste number 105738: toggle-dark-mode for conkeror
Pasted by: scottj
When:1 year, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+29L6
Channel:#conkeror
Paste contents:
Raw Source | XML | Display As
// toggle dark mode, adapted from someone else's one-way non-global darken function
dark_css_uri =
    make_css_data_uri(['*:not(img) { background: #242424 ! important; color: #f6f3e8 !important }',
                       ':link, :link * { color: #8ac6f2 !important }',
                       ':visited, :visited * { color: #95e454 !important }'],
                      $url_prefixes = ["http", "about"]);

dark_mode = false;

interactive("toggle-dark-mode", "Switch between normal and dark mode.",
            function (I) {
                if (dark_mode) {
                    unregister_user_stylesheet(darken_uri);
                    dark_mode = false;                    
                } else {
                    register_user_stylesheet(darken_uri);
                    dark_mode = true;
                }
            });
define_key(default_global_keymap, "D", "toggle-dark-mode");

Annotations for this paste:

Annotation number 1: correction
Pasted by: scottj
When:1 year, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+29L6/1
Paste contents:
Raw Source | Display As
interactive("toggle-dark-mode", "Switch between normal and dark mode.",
            function (I) {
                if (dark_mode) {
                    unregister_user_stylesheet(dark_css_uri);
                    dark_mode = false;                    
                } else {
                    register_user_stylesheet(dark_css_uri);
                    dark_mode = true;
                }
            });

Colorize as:
Show Line Numbers
Index of paste annotations: 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.