Skip to content

feat: add 0github diff themes#134

Open
lawrencecchen wants to merge 2 commits into
jnsahaj:mainfrom
lawrencecchen:feat/0github-theme
Open

feat: add 0github diff themes#134
lawrencecchen wants to merge 2 commits into
jnsahaj:mainfrom
lawrencecchen:feat/0github-theme

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Mar 24, 2026

Copy link
Copy Markdown

Summary

  • add 0github-dark and 0github-light diff theme presets derived from the manaflow 0github palette
  • add unit coverage for theme parsing and representative light/dark palette values
  • document the new presets in the diff theme README section

Test Plan

  • cargo test 0github
  • cargo test

Notes

  • cargo test currently fails on upstream/main in vcs::git::tests::test_get_merge_base_returns_ancestor
  • reproduced the same failure on a clean upstream/main worktree; the failing path is src/vcs/test_utils.rs assuming refs/heads/main exists after git2 repo init

Summary by CodeRabbit

  • New Features

    • Added GitHub Dark and Light themes to available diff viewer themes.
  • Documentation

    • Updated configuration examples and theme reference documentation to include the new GitHub Dark and Light theme options.

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Two new GitHub-themed color schemes (0github-dark and 0github-light) are added to the diff viewer theme system, including new enum variants, string parsing support, theme constructors, unit tests, and documentation updates reflecting the new theme options.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md
Updated theme configuration examples and added "0github" entry to the available themes table.
Theme System Implementation
src/command/diff/theme.rs
Added ZeroGithubDark and ZeroGithubLight enum variants to ThemePreset, updated FromStr parsing to recognize "0github-dark" and "0github-light" strings, implemented Theme::zero_github_dark() and Theme::zero_github_light() constructors with full color palettes, extended from_preset() to map new variants to constructors, and added unit tests for parsing and color validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Two new themes hop into sight,
GitHub dark and GitHub light,
Color palettes, parsed with care,
Fresh shades blooming everywhere! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add 0github diff themes' clearly and concisely summarizes the main change: adding two new theme presets (0github-dark and 0github-light) to the diff viewer functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/command/diff/theme.rs (1)

367-378: Consider reviewing deleted_bg and context_bg visual distinction.

Both deleted_bg (line 371) and context_bg (line 374) are set to pure white Color::Rgb(255, 255, 255), making deleted lines visually indistinguishable from context lines by background color alone. Other light themes use a subtle red/pink tint for deleted_bg.

This may be intentional to match GitHub's styling (which relies more heavily on gutter colors), but could reduce at-a-glance readability compared to other themes. Verify this matches the desired 0github palette behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/command/diff/theme.rs` around lines 367 - 378, The deleted_bg and
context_bg in the DiffColors initialization are both pure white (deleted_bg and
context_bg), which makes deleted lines visually indistinguishable; update the
DiffColors struct initialization to give deleted_bg a subtle red/pink tint
(e.g., a very light pink close to the theme palette) while leaving context_bg as
white, or explicitly document/confirm the intent if pure white was deliberate;
locate the DiffColors block (the DiffColors instance where
added_bg/added_gutter_bg/.../deleted_word_bg are set) and change deleted_bg to a
slightly tinted RGB value that matches the 0github palette, then run a visual
check to ensure contrast with context_bg.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/command/diff/theme.rs`:
- Around line 367-378: The deleted_bg and context_bg in the DiffColors
initialization are both pure white (deleted_bg and context_bg), which makes
deleted lines visually indistinguishable; update the DiffColors struct
initialization to give deleted_bg a subtle red/pink tint (e.g., a very light
pink close to the theme palette) while leaving context_bg as white, or
explicitly document/confirm the intent if pure white was deliberate; locate the
DiffColors block (the DiffColors instance where
added_bg/added_gutter_bg/.../deleted_word_bg are set) and change deleted_bg to a
slightly tinted RGB value that matches the 0github palette, then run a visual
check to ensure contrast with context_bg.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a83f18da-53af-48e3-be49-9811ea836134

📥 Commits

Reviewing files that changed from the base of the PR and between c0797c5 and 4b97d88.

📒 Files selected for processing (2)
  • README.md
  • src/command/diff/theme.rs

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