feat: respect terminal background theme#27
Conversation
Remove hardcoded `background: $surface` from Screen, FeedList, and modal containers so the user's terminal theme shows through. Replace the hardcoded HN-orange LoadingIndicator color with `$accent` design token.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdd ChangesTheme and UI updates
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27 +/- ##
==========================================
+ Coverage 70.99% 73.67% +2.68%
==========================================
Files 18 18
Lines 1010 1056 +46
==========================================
+ Hits 717 778 +61
+ Misses 293 278 -15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
devskim/config.py (1)
95-95: ⚡ Quick winNormalize and validate
themeinput before storing it.Line 95 currently stringifies any value and accepts unknown themes silently. Consider lowercasing and allowlisting (
"dark" | "light") so typos/config mistakes don’t get ignored.Proposed patch
- theme=str(raw.get("theme", "dark")), + theme=( + (theme := str(raw.get("theme", "dark")).strip().lower()) + if (theme := str(raw.get("theme", "dark")).strip().lower()) in {"dark", "light"} + else "dark" + ),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@devskim/config.py` at line 95, Normalize and validate the theme value returned from raw.get before storing it: instead of blindly stringifying raw.get("theme", "dark"), read it, lower-case it (e.g. theme_raw = raw.get("theme", "dark")), check against an allowlist {"dark", "light"}, and then assign the validated value (fallback to "dark" if not allowed); if you have a logger available emit a warning for unknown values. Update the expression at the site where theme=str(raw.get("theme", "dark")) is set (devskim/config.py) to perform this normalization and validation so only "dark" or "light" are stored.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@devskim/config.py`:
- Line 95: Normalize and validate the theme value returned from raw.get before
storing it: instead of blindly stringifying raw.get("theme", "dark"), read it,
lower-case it (e.g. theme_raw = raw.get("theme", "dark")), check against an
allowlist {"dark", "light"}, and then assign the validated value (fallback to
"dark" if not allowed); if you have a logger available emit a warning for
unknown values. Update the expression at the site where
theme=str(raw.get("theme", "dark")) is set (devskim/config.py) to perform this
normalization and validation so only "dark" or "light" are stored.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: aac79cdc-e7a6-4159-b6d4-51707195d93f
📒 Files selected for processing (6)
devskim/app.pydevskim/config.pydevskim/widgets/comments_modal.pydevskim/widgets/content_modal.pydevskim/widgets/feed.pydevskim/widgets/post_split_modal.py
💤 Files with no reviewable changes (4)
- devskim/widgets/content_modal.py
- devskim/widgets/comments_modal.py
- devskim/widgets/feed.py
- devskim/widgets/post_split_modal.py
🚧 Files skipped from review as they are similar to previous changes (1)
- devskim/app.py
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@devskim/app.py`:
- Around line 5-10: Unconditional POSIX imports (termios, tty) cause ImportError
on Windows and _terminal_is_dark() also consumes sys.stdin when called in
DevSkimApp.__init__; remove the top-level imports of termios and tty and move
them into _terminal_is_dark() behind a platform guard (e.g., check os.name or
sys.platform) so they are only imported on POSIX, and change DevSkimApp.__init__
to not call _terminal_is_dark() synchronously (delay the call until after
Textual has initialized or use a non-blocking/platform-safe fallback) so stdin
isn't read during initialization; update any references to _terminal_is_dark()
accordingly.
- Around line 35-52: The current startup probe uses sys.stdin (fd from
sys.stdin.fileno()) and tty.setraw(), which consumes the app's input; instead
open the controlling TTY returned by os.ctermid() and perform the raw-mode probe
on that separate file descriptor: call os.ctermid(), open that path (os.open) to
get a new fd, call termios.tcgetattr/tty.setraw on that fd (saving/restoring
attrs), write the OSC 11 probe to that fd and read from it with select/os.read,
then restore termios attributes and close the fd; remove use of
sys.stdin.fileno() for the probe so Textual's stdin is not modified.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 288e6fff-ab17-481b-addd-a4f8c39dd55d
📒 Files selected for processing (2)
devskim/app.pydevskim/config.py
🚧 Files skipped from review as they are similar to previous changes (1)
- devskim/config.py
Summary
background: $surfacefromScreen,FeedList,FeedList ListItem, and all modal containers — terminal background now shows throughcolor: #ff6600onLoadingIndicatorwith$accentdesign tokenTest plan
Summary by CodeRabbit
New Features
Style