diff --git a/pdf_viewer/config.cpp b/pdf_viewer/config.cpp index 1393ff90c..8cd665d42 100644 --- a/pdf_viewer/config.cpp +++ b/pdf_viewer/config.cpp @@ -28,6 +28,7 @@ extern bool HOVER_OVERVIEW; //extern bool AUTO_EMBED_ANNOTATIONS; extern bool DEFAULT_DARK_MODE; extern bool USE_SYSTEM_THEME; +extern bool USE_CUSTOM_AS_DARK; extern float HIGHLIGHT_COLORS[26 * 3]; extern std::wstring SEARCH_URLS[26]; extern std::wstring EXECUTE_COMMANDS[26]; @@ -716,6 +717,14 @@ ConfigManager::ConfigManager(const Path& default_path, const Path& auto_path, co bool_deserializer, bool_validator }); + configs.push_back({ + L"use_custom_as_dark", + ConfigType::Bool, + &USE_CUSTOM_AS_DARK, + bool_serializer, + bool_deserializer, + bool_validator + }); configs.push_back({ L"render_freetext_borders", ConfigType::Bool, diff --git a/pdf_viewer/main.cpp b/pdf_viewer/main.cpp index 173d372c6..8f9293293 100644 --- a/pdf_viewer/main.cpp +++ b/pdf_viewer/main.cpp @@ -200,6 +200,7 @@ bool SHOULD_USE_MULTIPLE_MONITORS = false; bool SHOULD_CHECK_FOR_LATEST_VERSION_ON_STARTUP = false; bool DEFAULT_DARK_MODE = false; bool USE_SYSTEM_THEME = false; +bool USE_CUSTOM_AS_DARK = false; bool SORT_BOOKMARKS_BY_LOCATION = true; std::wstring LIBGEN_ADDRESS = L""; std::wstring GOOGLE_SCHOLAR_ADDRESS = L""; diff --git a/pdf_viewer/main_widget.cpp b/pdf_viewer/main_widget.cpp index 3cfe2fef0..37b3b8c03 100644 --- a/pdf_viewer/main_widget.cpp +++ b/pdf_viewer/main_widget.cpp @@ -203,6 +203,7 @@ extern int NUM_CACHED_PAGES; extern bool IGNORE_SCROLL_EVENTS; extern bool DONT_FOCUS_IF_SYNCTEX_RECT_IS_VISIBLE; extern bool USE_SYSTEM_THEME; +extern bool USE_CUSTOM_AS_DARK; extern bool SHOW_RIGHT_CLICK_CONTEXT_MENU; extern std::wstring CONTEXT_MENU_ITEMS; @@ -3747,10 +3748,14 @@ CommandManager* MainWidget::get_command_manager() { } void MainWidget::toggle_dark_mode() { - this->opengl_widget->toggle_dark_mode(); + if (USE_CUSTOM_AS_DARK) { + toggle_custom_color_mode(); + } else { + this->opengl_widget->toggle_dark_mode(); - if (helper_opengl_widget_) { - helper_opengl_widget_->toggle_dark_mode(); + if (helper_opengl_widget_) { + helper_opengl_widget_->toggle_dark_mode(); + } } } @@ -6771,12 +6776,16 @@ int MainWidget::get_current_colorscheme_index() { } void MainWidget::set_dark_mode() { - if (opengl_widget->get_current_color_mode() != PdfViewOpenGLWidget::ColorPalette::Dark) { - opengl_widget->set_dark_mode(true); - } - if (helper_opengl_widget_) { - if (helper_opengl_widget_->get_current_color_mode() != PdfViewOpenGLWidget::ColorPalette::Dark) { - helper_opengl_widget_->set_dark_mode(true); + if (USE_CUSTOM_AS_DARK) { + set_custom_color_mode(); + } else{ + if (opengl_widget->get_current_color_mode() != PdfViewOpenGLWidget::ColorPalette::Dark) { + opengl_widget->set_dark_mode(true); + } + if (helper_opengl_widget_) { + if (helper_opengl_widget_->get_current_color_mode() != PdfViewOpenGLWidget::ColorPalette::Dark) { + helper_opengl_widget_->set_dark_mode(true); + } } } }