feat: add configurable dark mode themes #8

Merged
amanyadev merged 4 commits from feat/theme-selection into main 2025-10-14 22:31:22 -04:00
amanyadev commented 2025-10-14 20:21:48 -04:00 (Migrated from github.com)

Add theme selector dropdown with 6 options including Claude Warm, ChatGPT Cool, and other comfortable dark backgrounds. Improves readability by replacing harsh black inversion with softer color mapping.

Add theme selector dropdown with 6 options including Claude Warm, ChatGPT Cool, and other comfortable dark backgrounds. Improves readability by replacing harsh black inversion with softer color mapping.
chizkiyahu (Migrated from github.com) reviewed 2025-10-14 21:39:52 -04:00
chizkiyahu (Migrated from github.com) left a comment
Screenshot 2025-10-15 at 4 38 14 the btn are not on same line
<img width="473" height="126" alt="Screenshot 2025-10-15 at 4 38 14" src="https://github.com/user-attachments/assets/9a1f8747-7de2-4297-bcaf-8f0e178f0e0b" /> the btn are not on same line
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-10-14 21:40:42 -04:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR adds configurable dark mode themes to the PDF converter, replacing the harsh black inversion with softer color mapping options. Users can now select from 6 different themes including Claude Warm, ChatGPT Cool, and other comfortable dark backgrounds for improved readability.

  • Added theme selector dropdown with 6 predefined color themes
  • Replaced simple color inversion with brightness-based color mapping algorithm
  • Updated download filename to include selected theme name

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview This PR adds configurable dark mode themes to the PDF converter, replacing the harsh black inversion with softer color mapping options. Users can now select from 6 different themes including Claude Warm, ChatGPT Cool, and other comfortable dark backgrounds for improved readability. - Added theme selector dropdown with 6 predefined color themes - Replaced simple color inversion with brightness-based color mapping algorithm - Updated download filename to include selected theme name --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/Chizkiyahu/pdf-dark-mode-converter/new/main/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
@ -200,2 +265,4 @@
progressBar.style.width = '0';
progressText.innerText = `0/${pdf.numPages}`;
pdfContainer.innerHTML = '';
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-14 21:40:42 -04:00

The brightness calculation uses simple averaging instead of the more accurate luminance formula. Consider using 0.299*r + 0.587*g + 0.114*b for better perceptual brightness calculation.

                    const brightness = 0.299 * r + 0.587 * g + 0.114 * b;
The brightness calculation uses simple averaging instead of the more accurate luminance formula. Consider using `0.299*r + 0.587*g + 0.114*b` for better perceptual brightness calculation. ```suggestion const brightness = 0.299 * r + 0.587 * g + 0.114 * b; ```
@ -201,2 +268,4 @@
for (let i = 0; i < pdf.numPages; i++) {
if (renderId !== currentRenderId) {
return;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-14 21:40:42 -04:00

Missing documentation for the themes object. Add a comment explaining the structure and purpose of the RGB values for each theme.


        /**
         * The `themes` object defines available dark mode themes for the PDF converter.
         * Each theme is an object with the following properties:
         *   - r: Red component of the background color (0-255)
         *   - g: Green component of the background color (0-255)
         *   - b: Blue component of the background color (0-255)
         *   - name: Human-readable name of the theme
         * The RGB values are used to set the background color for each theme.
         */
Missing documentation for the themes object. Add a comment explaining the structure and purpose of the RGB values for each theme. ```suggestion /** * The `themes` object defines available dark mode themes for the PDF converter. * Each theme is an object with the following properties: * - r: Red component of the background color (0-255) * - g: Green component of the background color (0-255) * - b: Blue component of the background color (0-255) * - name: Human-readable name of the theme * The RGB values are used to set the background color for each theme. */ ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-10-14 21:40:42 -04:00

No validation that selectedTheme exists in the themes object. If an invalid theme is selected, this will throw an error when accessing .name property.

                const themeObj = themes[selectedTheme] || themes['classic'];
                const themeName = themeObj.name.toLowerCase().replace(/\s+/g, '_');
No validation that `selectedTheme` exists in the themes object. If an invalid theme is selected, this will throw an error when accessing `.name` property. ```suggestion const themeObj = themes[selectedTheme] || themes['classic']; const themeName = themeObj.name.toLowerCase().replace(/\s+/g, '_'); ```
chizkiyahu commented 2025-10-14 21:42:04 -04:00 (Migrated from github.com)

@amanyadev
is nice idea but is not fully polish

  1. the btn needs to fix
  2. updating the colors not rerun
    @Copilot please fix the 1 and 2
@amanyadev is nice idea but is not fully polish 1. the btn needs to fix 2. updating the colors not rerun @Copilot please fix the 1 and 2
chizkiyahu commented 2025-10-14 22:31:54 -04:00 (Migrated from github.com)

@amanyadev
thanks for the PR

@amanyadev thanks for the PR
amanyadev commented 2025-10-15 20:13:50 -04:00 (Migrated from github.com)

thanks for creating this @Chizkiyahu. It helped me while studying. Glad that I could contribute!

thanks for creating this @Chizkiyahu. It helped me while studying. Glad that I could contribute!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
chizkiyahu/pdf-dark-mode-converter!8
No description provided.