| 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: |
// 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: |
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;
}
});