Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added config for page separator color in dark mode #1133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pdf_viewer/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extern float TOUCHPAD_SENSITIVITY;
extern float SCROLL_VIEW_SENSITIVITY;
extern float PAGE_SEPARATOR_WIDTH;
extern float PAGE_SEPARATOR_COLOR[3];
extern float DARK_MODE_PAGE_SEPARATOR_COLOR[3];
extern int SINGLE_MAIN_WINDOW_SIZE[2];
extern int SINGLE_MAIN_WINDOW_MOVE[2];
extern float FIT_TO_PAGE_WIDTH_RATIO;
Expand Down Expand Up @@ -377,6 +378,7 @@ ConfigManager::ConfigManager(const Path& default_path, const Path& auto_path ,co
configs.push_back({ L"scrollview_sensitivity", &SCROLL_VIEW_SENSITIVITY, float_serializer, float_deserializer, nullptr });
configs.push_back({ L"page_separator_width", &PAGE_SEPARATOR_WIDTH, float_serializer, float_deserializer, nullptr });
configs.push_back({ L"page_separator_color", PAGE_SEPARATOR_COLOR, vec3_serializer, color3_deserializer, color_3_validator });
configs.push_back({ L"dark_mode_page_separator_color", DARK_MODE_PAGE_SEPARATOR_COLOR, vec3_serializer, color3_deserializer, color_3_validator });
configs.push_back({ L"single_main_window_size", &SINGLE_MAIN_WINDOW_SIZE, ivec2_serializer, ivec2_deserializer, nullptr });
configs.push_back({ L"single_main_window_move", &SINGLE_MAIN_WINDOW_MOVE, ivec2_serializer, ivec2_deserializer, nullptr });
configs.push_back({ L"fit_to_page_width_ratio", &FIT_TO_PAGE_WIDTH_RATIO, float_serializer, float_deserializer, nullptr });
Expand Down
1 change: 1 addition & 0 deletions pdf_viewer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ int PRERENDERED_PAGE_COUNT = 0;

float PAGE_SEPARATOR_WIDTH = 0.0f;
float PAGE_SEPARATOR_COLOR[3] = {0.9f, 0.9f, 0.9f};
float DARK_MODE_PAGE_SEPARATOR_COLOR[3] = {0.0f, 0.0f, 0.0f};
bool IGNORE_STATUSBAR_IN_PRESENTATION_MODE = false;
bool SUPER_FAST_SEARCH = false;
bool SHOW_CLOSEST_BOOKMARK_IN_STATUSBAR = false;
Expand Down
4 changes: 3 additions & 1 deletion pdf_viewer/pdf_view_opengl_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern bool RERENDER_OVERVIEW;
extern bool RULER_MODE;
extern float PAGE_SEPARATOR_WIDTH;
extern float PAGE_SEPARATOR_COLOR[3];
extern float DARK_MODE_PAGE_SEPARATOR_COLOR[3];
extern float RULER_PADDING;
extern float OVERVIEW_SIZE[2];
extern float OVERVIEW_OFFSET[2];
Expand Down Expand Up @@ -724,7 +725,8 @@ void PdfViewOpenGLWidget::render_page(int page_number) {
fz_rect separator_window_rect = document_view->document_to_window_rect(page_number, separator_rect);
rect_to_quad(separator_window_rect, page_vertices);

glUniform3fv(shared_gl_objects.separator_background_color_uniform_location, 1, PAGE_SEPARATOR_COLOR);
auto &separator_color = color_mode == ColorPalette::Dark ? DARK_MODE_PAGE_SEPARATOR_COLOR : PAGE_SEPARATOR_COLOR;
glUniform3fv(shared_gl_objects.separator_background_color_uniform_location, 1, separator_color);

glBindBuffer(GL_ARRAY_BUFFER, shared_gl_objects.vertex_buffer_object);
glBufferData(GL_ARRAY_BUFFER, sizeof(page_vertices), page_vertices, GL_DYNAMIC_DRAW);
Expand Down
1 change: 1 addition & 0 deletions pdf_viewer/prefs.config
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ wheel_zoom_on_cursor 0
## Configure the appearance of page separator
#page_separator_width 2
#page_separator_color 0.9 0.9 0.9
#dark_mode_page_separator_color 0.0 0.0 0.0

# Ratio of page width to use for `fit_to_page_width_ratio` command
fit_to_page_width_ratio 0.75
Expand Down
5 changes: 5 additions & 0 deletions resources/sioyek.1
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,11 @@ Width of the page separator.

Color of the page separator.
.HP
.B dark_mode_page_separator_color
.I color_3

Color of the page separator in dark mode.
.HP
.B single_main_window_size
.I ivec[2]

Expand Down