Skip to content

Conversation

codiewood
Copy link

Added versions of functions (except the dracula_brand function) with the new alucard light mode colour specs from this open pr. Also included relevant tests following the same format as the original dRacula functions.

Everything follows the dracula theme versions, just with the relevant colours swapped for those in the alucard palette. Only exception is that in theme_alucard() the legend.box.background variable has fill set to "transparent" rather than "#CFCFDE", as I felt that looked better.

Copy link

coderabbitai bot commented Jul 12, 2025

📝 Walkthrough

Walkthrough

The changes introduce a new "Alucard" theme and associated color palette for use with ggplot2 in R. This includes new exported palette data, discrete and continuous scale functions, a custom theme function, comprehensive documentation, and corresponding unit tests to ensure correct palette behavior and integration with ggplot2 plots.

Changes

Files/Paths Change Summary
NAMESPACE Exported: alucard_tibble, scale_color_alucard, scale_colour_alucard, scale_fill_alucard, theme_alucard
R/alucard_palette.R Added: alucard_tibble (palette data), internal palette functions, and discrete palette function
R/scales.R Added: scale_fill_alucard, scale_color_alucard, scale_colour_alucard functions for ggplot2
R/theme_alucard.R Added: theme_alucard function for a minimal, light ggplot2 theme
man/alucard_tibble.Rd Added: Documentation for alucard_tibble dataset
man/scale_alucard.Rd Added: Documentation for scale_fill_alucard, scale_color_alucard, scale_colour_alucard
man/theme_alucard.Rd Added: Documentation for theme_alucard
tests/testthat/test-alucard_palette.R Added: Tests for alucard_discrete_bright_palette (length and error handling)
tests/testthat/test-scales.R Added: Tests for "alucard" scales and theme in ggplot2 visualizations
tests/testthat/test-theme_alucard.R Added: Test for theme_alucard() error-free execution

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ggplot2
    participant dRacula (package)
    participant theme_alucard
    participant scale_*_alucard
    participant alucard_tibble

    User->>ggplot2: Create plot with theme_alucard() and scale_*_alucard()
    ggplot2->>theme_alucard: Apply theme customization
    ggplot2->>scale_*_alucard: Apply color/fill scale
    scale_*_alucard->>alucard_tibble: Retrieve palette colors
    ggplot2-->>User: Rendered plot with Alucard theme and colors
Loading
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • 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.

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: 1

🧹 Nitpick comments (2)
tests/testthat/test-theme_alucard.R (1)

1-3: LGTM! Consider adding more comprehensive theme validation tests.

The basic smoke test is appropriate and follows testthat conventions correctly. However, consider adding tests that validate the theme actually returns a proper ggplot2 theme object and that key theme elements are set correctly.

Example additional test:

test_that("theme_alucard returns a proper theme object", {
  theme_obj <- theme_alucard()
  expect_s3_class(theme_obj, "theme")
  expect_s3_class(theme_obj, "gg")
})
R/alucard_palette.R (1)

1-10: Fix the documentation URL reference.

The documentation references https://spec.draculatheme.com but this is for the Alucard palette, not Dracula. This appears to be a copy-paste error from the original Dracula implementation.

-#' @description A Tibble of Alucard data that includes the palette specification.
-#'  See https://spec.draculatheme.com for details.
+#' @description A Tibble of Alucard data that includes the palette specification.
+#'  Alucard is a light mode variant of the Dracula theme.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62c369c and 3720738.

⛔ Files ignored due to path filters (3)
  • tests/testthat/_snaps/scales/diamonds-point-plot-alucard.svg is excluded by !**/*.svg
  • tests/testthat/_snaps/scales/mtcars-lm-plot-alucard.svg is excluded by !**/*.svg
  • tests/testthat/_snaps/scales/rnorm-hex-plot-alucard.svg is excluded by !**/*.svg
📒 Files selected for processing (10)
  • NAMESPACE (1 hunks)
  • R/alucard_palette.R (1 hunks)
  • R/scales.R (1 hunks)
  • R/theme_alucard.R (1 hunks)
  • man/alucard_tibble.Rd (1 hunks)
  • man/scale_alucard.Rd (1 hunks)
  • man/theme_alucard.Rd (1 hunks)
  • tests/testthat/test-alucard_palette.R (1 hunks)
  • tests/testthat/test-scales.R (1 hunks)
  • tests/testthat/test-theme_alucard.R (1 hunks)
🔇 Additional comments (9)
tests/testthat/test-alucard_palette.R (1)

1-8: Excellent test coverage for the palette function.

The tests comprehensively cover the key behaviors:

  • Default palette size validation
  • Custom size validation
  • Error handling for invalid input

The test structure follows testthat best practices and provides good coverage for a discrete palette function.

man/theme_alucard.Rd (1)

12-31: Excellent documentation examples.

The examples demonstrate both common usage patterns effectively:

  • Global theme setting with theme_set()
  • Pipeline usage with data manipulation and plotting

The examples are practical and help users understand how to integrate the theme with the Alucard color scales.

NAMESPACE (1)

3-12: NAMESPACE exports are correctly structured.

The new Alucard-related exports are properly added:

  • alucard_tibble dataset export
  • Scale functions with both American (scale_color_alucard) and British (scale_colour_alucard) spelling variants
  • theme_alucard function export

The exports maintain consistency with the existing Dracula theme exports and follow R package conventions.

man/alucard_tibble.Rd (1)

1-21: Well-structured dataset documentation.

The documentation properly follows R conventions for dataset documentation:

  • Correct docType and format specifications
  • Appropriate description linking to the theme specification
  • Proper keyword classification as "datasets"

The reference to the Dracula theme specification website provides helpful context for users wanting to understand the color palette origins.

man/scale_alucard.Rd (1)

1-26: LGTM! Well-structured documentation.

The documentation follows proper R package conventions with correct roxygen2 formatting, appropriate aliases, and comprehensive parameter descriptions.

R/theme_alucard.R (1)

1-49: Excellent theme implementation with comprehensive documentation.

The theme follows best practices by extending theme_minimal() and provides a well-designed light color scheme. The examples are particularly helpful, showing both global theme setting and pipeline usage.

R/scales.R (1)

38-72: Excellent implementation mirroring existing patterns.

The Alucard scale functions perfectly mirror the existing Dracula implementation, ensuring consistency across the codebase. The conditional logic for discrete vs continuous scales is correct, and the British spelling alias is properly included.

tests/testthat/test-scales.R (1)

50-90: Comprehensive test coverage with proper visual regression testing.

The new test cases effectively mirror the existing Dracula tests and provide thorough coverage of the Alucard scales. The use of expect_doppelganger for visual regression testing is the appropriate approach for ggplot2 themes and scales.

R/alucard_palette.R (1)

11-65: Well-implemented palette with proper validation.

The color palette definition and helper functions are excellently implemented. The tibble structure with hex, RGB, and HSL values is comprehensive, and the discrete palette function includes proper validation for maximum color count.

theme_alucard()
}
\description{
Provides a minimal \code{ggplot2} theme with a Alucard, light backdrop.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix grammatical error in the description.

There's an extra article "a" before "Alucard" in the description.

-Provides a minimal \code{ggplot2} theme with a Alucard, light backdrop.
+Provides a minimal \code{ggplot2} theme with an Alucard light backdrop.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Provides a minimal \code{ggplot2} theme with a Alucard, light backdrop.
Provides a minimal \code{ggplot2} theme with an Alucard light backdrop.
🤖 Prompt for AI Agents
In man/theme_alucard.Rd at line 10, remove the extra article "a" before
"Alucard" in the description to fix the grammatical error. The phrase should
read "with Alucard, light backdrop" instead of "with a Alucard, light backdrop."

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

Successfully merging this pull request may close these issues.

1 participant