Skip to content

Conversation

@chmurson
Copy link
Collaborator

@chmurson chmurson commented Aug 26, 2025

What?

  • fixed backgrounds of pdf viewr pages to match correctly dark/light modes
  • fixed some colors that wrongly picked dark/light colors in right side bar due to css's light-dark() function was not setup with app's dark/light theme

Summary by CodeRabbit

  • Style
    • Updated PDF viewer page background to a fixed dark tone for clearer page contrast.
    • Improved text color in empty note states and search results to align with sidebar foreground styling.
    • Introduced a theme-aware sidebar foreground color variable, enhancing readability in light and dark modes.
    • Minor visual refinements applied without changing behavior or user flows.

@coderabbitai
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Updates apply presentational styling: adds text color classes to NotesList and Search empty/results states, changes PdfViewer page background to a fixed dark color, and introduces a new CSS variable --sidebar-foreground with a theme alias in tailwind.css. No logic, state, or public API changes.

Changes

Cohort / File(s) Summary of Changes
UI text color classes
src/components/NoteManager/components/NotesList.tsx, src/components/Search/Search.tsx
Added text-sidebar-foreground to empty-state container in NotesList and to Search results container; no logic changes.
PDF viewer page background
src/components/PdfViewer/PdfViewer.css
Replaced .pdfViewer .page background from var(--sidebar) to fixed #101010; other rules unchanged.
Theme variables
src/tailwind.css
Added --sidebar-foreground in :root (default var(--color-gray-600)), set dark-theme override, exposed --color-sidebar-foreground in @theme; no other variable changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • DrEverr
  • mateuszsikora

Poem

I nibble CSS like clover at dawn,
Tinting pages dark where PDFs yawn.
Notes whisper softly, in sidebar light,
Search now gleams with readable white.
New vars sprout—foreground bright—
Hop, hop, ship it; styles just right. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-auto-light-dark-color-scheme

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Aug 26, 2025

Deploy Preview for graypaper-reader ready!

Name Link
🔨 Latest commit aa412a6
🔍 Latest deploy log https://app.netlify.com/projects/graypaper-reader/deploys/68ae2ff9887df8000858b0be
😎 Deploy Preview https://deploy-preview-293--graypaper-reader.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chmurson chmurson merged commit adcc16a into main Aug 26, 2025
7 of 8 checks passed
@chmurson chmurson deleted the fix-auto-light-dark-color-scheme branch August 26, 2025 22:11
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/Search/Search.tsx (1)

177-177: Use twMerge instead of string interpolation for class merging.

Keeps Tailwind class handling consistent in this file (you already import twMerge above) and avoids accidental duplicates.

Apply:

-      <div className={`search-results text-sidebar-foreground ${isLoading ? "search-loading" : ""}`}>
+      <div className={twMerge("search-results text-sidebar-foreground", isLoading && "search-loading")}>
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c50924c and aa412a6.

📒 Files selected for processing (4)
  • src/components/NoteManager/components/NotesList.tsx (1 hunks)
  • src/components/PdfViewer/PdfViewer.css (1 hunks)
  • src/components/Search/Search.tsx (1 hunks)
  • src/tailwind.css (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

⚙️ CodeRabbit configuration file

When reviewing Tailwind CSS classes, ensure they follow Tailwind 4.x conventions and suggest modern 4.x alternatives for deprecated patterns.

Files:

  • src/components/NoteManager/components/NotesList.tsx
  • src/components/Search/Search.tsx
**/*.css

⚙️ CodeRabbit configuration file

Review CSS code with focus on Tailwind CSS 4.x best practices and conventions. Ensure compatibility with Tailwind 4.x features and syntax.

Files:

  • src/components/PdfViewer/PdfViewer.css
  • src/tailwind.css
🔇 Additional comments (3)
src/components/NoteManager/components/NotesList.tsx (1)

15-15: Semantic color token usage looks good.

Applying text-sidebar-foreground to the empty state aligns with the new Tailwind v4 @theme color alias and keeps the UI consistent across themes.

src/tailwind.css (2)

13-16: Good: introduces a semantic foreground variable and sets the default color-scheme.

Using --sidebar-foreground with color-scheme: light at :root is aligned with Tailwind v4 token-driven theming.


34-35: Theme alias for Tailwind v4 utilities is correct.

--color-sidebar-foreground exposes text-sidebar-foreground which you’re using in components—this is the recommended v4 pattern.

Comment on lines +20 to +22
.pdfViewer .page{
background-color: #101010;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid hard-coding the page background; keep it themable.

Replacing var(--sidebar) with #101010 makes the PDF page background non-configurable and may diverge from light/gray modes or future themes. Prefer a semantic token with a safe fallback.

Apply:

-.pdfViewer .page{
-  background-color: #101010;
-}
+.pdfViewer .page{
+  /* Use a semantic token so themes can control page bg; default to current dark */
+  background-color: var(--page-bg, #101010);
+}

Then define the token (outside this hunk) to preserve dark/light behavior. For example, in your theme stylesheet:

:root { --page-bg: var(--color-gray-50); } /* light/gray default */
.dark  { --page-bg: #101010; }             /* dark override */

Alternatively, if var(--sidebar) was the intended source of truth, consider reverting to it to keep behavior aligned with the rest of the app theme.

I can wire this token into @theme as --color-page-bg to get bg-page-bg utilities if you prefer Tailwind-first usage.

🤖 Prompt for AI Agents
In src/components/PdfViewer/PdfViewer.css around lines 20 to 22, the PDF page
background is hard-coded to #101010 which breaks theming; replace the literal
color with a CSS variable (e.g., var(--page-bg) or revert to var(--sidebar)) so
the background is themeable and provide a safe fallback (e.g., var(--page-bg,
#101010)); then add the --page-bg token in the global theme stylesheet with a
light default and a .dark override (or wire it into @theme as --color-page-bg)
so the component respects light/dark and future themes.

Comment on lines +18 to 24
.dark{
--sidebar-foreground: rgb(255 255 255);
--sidebar-foreground: var(--color-gray-300);
/* Force light mode rendering */

color-scheme: dark;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Duplicate assignment of --sidebar-foreground; second one overrides the first. Clarify intent and keep a single value.

In .dark you set:

  • --sidebar-foreground: rgb(255 255 255);
  • then immediately --sidebar-foreground: var(--color-gray-300); (this wins)

If white was intended, the current code never uses it. If gray-300 was intended, drop the first line. You can also use a CSS var fallback if you truly want “use gray-300 if defined, otherwise white”.

Pick one of these:

Option A (prefer gray-300):

 .dark{
-  --sidebar-foreground: rgb(255 255 255);
-  --sidebar-foreground: var(--color-gray-300);
+  --sidebar-foreground: var(--color-gray-300);
   /* Force light mode rendering */
 
   color-scheme: dark;
 }

Option B (prefer white with gray-300 fallback if token is missing):

 .dark{
-  --sidebar-foreground: rgb(255 255 255);
-  --sidebar-foreground: var(--color-gray-300);
+  --sidebar-foreground: var(--color-gray-300, rgb(255 255 255));
   /* Force light mode rendering */
 
   color-scheme: dark;
 }

Also, the comment “Force light mode rendering” inside the dark block is misleading. Consider updating it:

-  /* Force light mode rendering */
+  /* Advertise dark color scheme to the UA */

Please sanity-check contrast of text-sidebar-foreground on dark surfaces after this change in both themes.


🏁 Script executed:

#!/bin/bash
# Locate the `.dark` rule in src/tailwind.css and show its contents with surrounding context
rg -nP '\.dark\s*\{' -C5 src/tailwind.css

Length of output: 306


Remove or consolidate the duplicate --sidebar-foreground assignment in .dark

The .dark rule in src/tailwind.css currently sets:

.dark {
  --sidebar-foreground: rgb(255 255 255);
  --sidebar-foreground: var(--color-gray-300);
  /* Force light mode rendering */
  color-scheme: dark;
}

The second declaration immediately overrides the first—so white is never used. Decide which token you actually need, or combine them via a fallback. Also update the misleading comment inside a dark‐mode block.

Locations to update:

  • src/tailwind.css:18–24

Suggested fixes (pick one):

Option A: Prefer gray-300

 .dark {
-  --sidebar-foreground: rgb(255 255 255);
-  --sidebar-foreground: var(--color-gray-300);
+  --sidebar-foreground: var(--color-gray-300);
   /* Advertise dark color scheme to the UA */
   color-scheme: dark;
 }

Option B: Prefer white, fall back to gray-300

 .dark {
-  --sidebar-foreground: rgb(255 255 255);
-  --sidebar-foreground: var(--color-gray-300);
+  --sidebar-foreground: var(--color-gray-300, rgb(255 255 255));
   /* Advertise dark color scheme to the UA */
   color-scheme: dark;
 }

• Replace the comment /* Force light mode rendering */ with something like /* Advertise dark color scheme to the UA */.
• After you update these values, please sanity-check the contrast of your .text-sidebar-foreground utility on dark backgrounds.

🤖 Prompt for AI Agents
In src/tailwind.css around lines 18–24, the .dark rule has a duplicate
--sidebar-foreground that overrides the first; remove the duplicate and
implement one of the suggested fixes: either set --sidebar-foreground:
var(--color-gray-300); (Option A) or set --sidebar-foreground: rgb(255 255 255,
fallback to var(--color-gray-300)) using a CSS fallback pattern (Option B);
replace the misleading comment "/* Force light mode rendering */" with "/*
Advertise dark color scheme to the UA */"; after making the change, verify the
.text-sidebar-foreground utility still meets contrast requirements on dark
backgrounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant