Skip to content

Conversation

@anya-xcode
Copy link

@anya-xcode anya-xcode commented Nov 22, 2025

Fixes #2848

This PR addresses issue #2848 by improving the theme customization documentation and resolving plugin compatibility issues.

Checks

  • Ran yarn test-build
  • Updated relevant documentations
  • Updated matching config options in altair-static

Changes proposed in this pull request:

1. Enhanced ITheme Interface Documentation (theme.ts)

  • Added comprehensive JSDoc comments for all 30+ properties in the ITheme interface.

  • Each property now includes:

    • Clear purpose and usage
    • Associated CSS variable
    • Example values
    • Visual UI location reference

2. Fixed Apollo Tracing Plugin Light Theme Compatibility (tracing.css)

  • Added explicit background color using theme CSS variables.
  • Added padding and border-radius for better structure.
  • Adjusted bar opacity for visibility across both light and dark themes.
  • Ensures proper appearance and readability in all themes.

3. Complete Rewrite of Theme Customization Guide (theme-customization.md)

  • Added detailed explanations of theme property groups.

  • Included visual mapping tables for UI elements.

  • Added property reference tables for:

    • Core Colors (8)
    • UI State Colors (6)
    • Editor Colors (10+)
    • Typography (4)
    • Shadow Effects (2)
  • Added accessibility tips, contrast guidelines, and best practices.

  • Included common theme patterns and real-world examples for customization.

Issues Resolved

  • Clear and detailed documentation for all theme properties.
  • Accurate visual mapping between theme properties and UI components.
  • Apollo Tracing plugin now renders correctly in light themes.
  • Improved developer experience through structured JSDoc comments.
  • More accessible and user-friendly theme customization guide.

Summary by Sourcery

Improve theme customization guidance and align theme configuration docs with the core theme interface while ensuring plugin UI respects theme colors in both light and dark modes.

Enhancements:

  • Add detailed documentation comments to theme color and editor properties in the core theme interface to clarify their purpose and UI impact.
  • Expand the theme customization guide with explanations, visual mappings, examples, and accessibility guidance for configuring themes effectively.
  • Adjust Apollo Tracing plugin styling to consume theme CSS variables for backgrounds, text, and accents for consistent appearance across themes.

Tests:

  • Add a test scaffold for the Apollo Tracing plugin component to support future validation of theme-related behavior.

Summary by CodeRabbit

  • Documentation

    • Enhanced theme customization guide with detailed property explanations, accessible theming tips, and common theme pattern examples.
    • Added theme configuration examples and visual UI mapping guide.
  • Style

    • Improved Apollo Tracing plugin visual styling with better theme-aware colors, contrast, and backgrounds.
  • Tests

    • Added comprehensive test suite for Apollo Tracing plugin theme compatibility across light and dark themes.

✏️ Tip: You can customize this high-level summary in your review settings.

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 22, 2025

Reviewer's Guide

This PR enhances the theme customization experience by greatly expanding ITheme JSDoc/documentation, aligning the public docs with those semantics, and fixing Apollo Tracing plugin styles to correctly respect theme variables in light and dark modes.

Flow diagram for theme configuration and themed Apollo Tracing plugin rendering

flowchart LR
  user["Developer"]
  settings["Altair settings with themeConfig"]
  itheme["ITheme interface (documented theme properties)"]
  cssVars["Computed CSS variables (e.g. --theme-bg-color, --primary-color)"]
  mainUI["Main Altair UI components"]
  tracingPlugin["Apollo Tracing plugin panel"]
  tracingStyles["Tracing CSS using theme variables"]

  user -->|"Configures themeConfig"| settings
  settings -->|"Validated and mapped to"| itheme
  itheme -->|"Generates"| cssVars
  cssVars -->|"Applied as styles to"| mainUI
  cssVars -->|"Provided to"| tracingPlugin
  tracingPlugin -->|"Styled by"| tracingStyles
  tracingStyles -->|"Uses --theme-bg-color, --theme-font-color, --theme-off-font-color, --primary-color"| tracingPlugin

  mainUI -->|"Consistent theming in light and dark modes"| user
  tracingPlugin -->|"Readable tracing UI in light and dark themes"| user
Loading

File-Level Changes

Change Details Files
Add detailed, usage-focused JSDoc to core theme and editor properties so theme authors can reliably map config to UI and CSS variables.
  • Expanded comments for foundation and brand color fields to describe their semantic usage, typical UI locations, and related CSS variables.
  • Documented background, text, and border color properties with guidance on contrast, hierarchy, and how they map to specific surfaces and variables.
  • Enhanced editor typography and syntax-color properties with GraphQL-specific examples and explicit CSS variable names to clarify how the code editor is themed.
packages/altair-core/src/theme/theme.ts
Rewrite and expand the theme customization guide to mirror the ITheme semantics, add visual mapping, and provide best-practice guidance.
  • Added sections explaining theme property categories (background, text, borders, brand, editor, typography) and what UI parts they control.
  • Introduced visual mapping tables that connect theme properties and CSS variables to concrete UI elements (main app areas, text, interactive elements, editor syntax, plugin panels).
  • Added accessibility tips, contrast guidelines, and example theme configs for common patterns like high-contrast dark and warm light themes.
packages/altair-docs/docs/features/theme-customization.md
Bring Apollo Tracing plugin styling in line with theme variables to ensure readability in light and dark themes.
  • Set tracing row container background to the theme background with padding and border-radius to improve structure and contrast.
  • Updated tracing text colors to use theme font and off-font variables for name and duration, ensuring appropriate emphasis and legibility.
  • Adjusted tracing bar styling to use primary color with slight opacity so it remains visible against diverse backgrounds.
plugins/apollo-tracing/src/components/Tracing/tracing.css
plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts

Assessment against linked issues

Issue Objective Addressed Explanation
#2848 Provide clear, detailed documentation for the ITheme interface and theme customization so users understand what each property (e.g., colors.offBg, colors.tertiary, editor colors) controls.
#2848 Ensure plugins such as altair-graphql-plugin-apollo-tracing properly respect theme colors and are readable in light themes (i.e., plugin visuals integrate with the main theme settings).
#2848 Improve the advanced theme editor UX by providing live preview of theme changes as they are edited (without requiring Save) and reverting to the original colors if settings are closed without saving. The PR modifies documentation and plugin styling but does not introduce any changes to the advanced settings UI or theme editing behavior (no live preview or revert-on-cancel logic is added).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Nov 22, 2025

Walkthrough

The pull request enhances theme documentation and improves Apollo Tracing plugin theme compatibility. It adds descriptive comments to the ITheme interface, expands theme customization documentation with color property mappings and examples, applies theme-aware CSS updates to the tracing component, and introduces comprehensive test coverage for theme compatibility across light and dark themes.

Changes

Cohort / File(s) Summary
ITheme Interface Documentation
packages/altair-core/src/theme/theme.ts
Adds extensive descriptive comments documenting theme interface properties, color definitions, branding options, backgrounds, editor colors, and CSS variable mappings.
Theme Customization Guide
packages/altair-docs/docs/features/theme-customization.md
Expands documentation with color property explanations, editor color mappings, example theme configuration, accessibility tips, common theme patterns (high contrast dark and warm light), and visual UI element mapping.
Apollo Tracing Theme Styling
plugins/apollo-tracing/src/components/Tracing/tracing.css
Adds theme-aware CSS enhancements: background color and padding for name wrapper, theme-based text colors, reduced opacity for visual elements, and border radius for improved contrast.
Apollo Tracing Theme Tests
plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
Introduces new Jest test suite validating CSS variable usage, light/dark theme compatibility, text contrast, opacity handling, fallback values, and BEM naming conventions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • theme.ts: Verify comment accuracy for ITheme properties and consistency with implementation.
  • theme-customization.md: Cross-check documentation examples against actual theme properties and ensure all color/property mappings are correct and complete.
  • tracing.css: Validate CSS variables align with theme definitions and test visual rendering in both light and dark themes.
  • tracing.spec.ts: Verify test coverage adequately validates theme compatibility scenarios and CSS variable fallbacks are appropriate.

Poem

🐰 A theme so fine, now documented with care,
Colors mapped bright, for eyes everywhere!
Apollo's tracing now dances in light,
Dark or bright backgrounds—the plugin shines right! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is partially related to the changeset, referring to a real aspect (theme documentation and plugin light theme fixes), but appears truncated and doesn't fully communicate the complete scope of changes. Complete the title to clearly describe all main changes; consider: 'Improve theme customization documentation, enhance ITheme JSDoc, and fix plugin light theme compatibility'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR comprehensively addresses issue #2848 objectives: detailed ITheme documentation with JSDoc, Apollo Tracing plugin light theme compatibility fixes, and complete theme customization guide with property mappings.
Out of Scope Changes check ✅ Passed All changes directly support issue #2848 requirements: theme.ts enhances ITheme documentation, tracing.css/spec.ts fix plugin light theme issues, and theme-customization.md provides detailed property documentation and visual mappings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @anya-xcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the user experience for theme customization by providing extensive documentation and fixing a critical theme compatibility issue. It enhances the ITheme interface with detailed JSDoc comments, ensuring developers have clear guidance on theme properties. Concurrently, it resolves a long-standing problem with the Apollo Tracing plugin's appearance in light themes, making it visually consistent. Finally, the theme customization guide has been entirely rewritten to be more comprehensive and user-friendly, offering practical advice and visual aids for effective theme creation.

Highlights

  • Enhanced Theme Interface Documentation: Comprehensive JSDoc comments were added to over 30 properties in the ITheme interface, detailing their purpose, associated CSS variables, example values, and visual UI locations.
  • Improved Apollo Tracing Plugin Compatibility: The Apollo Tracing plugin's light theme appearance was fixed by explicitly setting background color using theme CSS variables, adding padding and border-radius for better structure, and adjusting bar opacity for visibility across all themes.
  • Rewritten Theme Customization Guide: The theme-customization.md documentation was completely overhauled, now including detailed explanations of theme property groups, visual mapping tables for UI elements, property reference tables, accessibility tips, and real-world customization examples.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Some of the new ITheme JSDoc descriptions (e.g., colors.cerise vs colors.red/colors.lightRed) overlap in responsibility for error and warning states; consider tightening this language so it’s clear which color is preferred for which kinds of status UI.
  • In tracing.css, forcing a solid background: var(--theme-bg-color, transparent) on .tracing-row__label may override any existing row striping or panel backgrounds; consider using a more transparent background or inheriting the parent background to avoid visual clashes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Some of the new ITheme JSDoc descriptions (e.g., `colors.cerise` vs `colors.red`/`colors.lightRed`) overlap in responsibility for error and warning states; consider tightening this language so it’s clear which color is preferred for which kinds of status UI.
- In `tracing.css`, forcing a solid `background: var(--theme-bg-color, transparent)` on `.tracing-row__label` may override any existing row striping or panel backgrounds; consider using a more transparent background or inheriting the parent background to avoid visual clashes.

## Individual Comments

### Comment 1
<location> `packages/altair-core/src/theme/theme.ts:86-95` </location>
<code_context>

-    /** Primary brand color used for main interactive elements */
+    // Brand colors - Main theme colors used for interactive elements
+    /** 
+     * Primary brand color used for main interactive elements.
+     * Controls: Primary buttons, active tabs, main action buttons, focus indicators, checkboxes.
</code_context>

<issue_to_address>
**suggestion:** Clarify separation between `variable` and `property`/`definition` editor colors to avoid confusing theme authors.

Right now `variable` is described as `$variableName, field names, type names`, but `property` already covers field names and `definition` covers type/operation names. This overlap makes it unclear how each token should be used when building themes. Consider narrowing `variable` to `$variableName` (and possibly argument identifiers) so its scope is clearly distinct from `property` and `definition`, helping avoid inconsistent theming choices.

Suggested implementation:

```typescript
    /** 
     * Color for variables and argument identifiers in queries.
     * Used for:
     * - Variable identifiers (e.g. $variableName)
     * - Argument identifiers in field/operation signatures (e.g. id, limit, offset)
     *
     * Note:
     * - Field names should be styled using the "property" color.
     * - Type and operation names should be styled using the "definition" color.
     */
    variable: string;

```

If the file also contains JSDoc comments for:
- `property` (e.g. "Color for object properties / field names" or similar), and
- `definition` (e.g. "Color for type/operation names"),

it would be good to:
1) Explicitly mention in the `property` comment that it is used for:
   - Field names in GraphQL queries (e.g. user, posts, title)
   - Object keys/properties in related UI representations, if applicable.
2) Explicitly mention in the `definition` comment that it is used for:
   - Type names (e.g. User, Post)
   - Operation names (e.g. getUser, listPosts)
   - Fragment names, if your tokenizer exposes them as definitions.

Adjust the wording of those comments to match your existing style and terminology in `theme.ts`, but keep the separation:
- `variable` = `$variableName` + argument identifiers
- `property` = field/property names
- `definition` = type/operation (and optionally fragment) names
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +86 to +95
/**
* Primary brand color used for main interactive elements.
* Controls: Primary buttons, active tabs, main action buttons, focus indicators, checkboxes.
* CSS Variable: --primary-color
*/
primary: string;
/** Secondary brand color used for supporting interactive elements */
/**
* Secondary brand color used for supporting interactive elements.
* Controls: Secondary buttons, links, informational icons.
* CSS Variable: --secondary-color
Copy link

Choose a reason for hiding this comment

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

suggestion: Clarify separation between variable and property/definition editor colors to avoid confusing theme authors.

Right now variable is described as $variableName, field names, type names, but property already covers field names and definition covers type/operation names. This overlap makes it unclear how each token should be used when building themes. Consider narrowing variable to $variableName (and possibly argument identifiers) so its scope is clearly distinct from property and definition, helping avoid inconsistent theming choices.

Suggested implementation:

    /** 
     * Color for variables and argument identifiers in queries.
     * Used for:
     * - Variable identifiers (e.g. $variableName)
     * - Argument identifiers in field/operation signatures (e.g. id, limit, offset)
     *
     * Note:
     * - Field names should be styled using the "property" color.
     * - Type and operation names should be styled using the "definition" color.
     */
    variable: string;

If the file also contains JSDoc comments for:

  • property (e.g. "Color for object properties / field names" or similar), and
  • definition (e.g. "Color for type/operation names"),

it would be good to:

  1. Explicitly mention in the property comment that it is used for:
    • Field names in GraphQL queries (e.g. user, posts, title)
    • Object keys/properties in related UI representations, if applicable.
  2. Explicitly mention in the definition comment that it is used for:
    • Type names (e.g. User, Post)
    • Operation names (e.g. getUser, listPosts)
    • Fragment names, if your tokenizer exposes them as definitions.

Adjust the wording of those comments to match your existing style and terminology in theme.ts, but keep the separation:

  • variable = $variableName + argument identifiers
  • property = field/property names
  • definition = type/operation (and optionally fragment) names

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the theme customization documentation and fixes an important display issue with the Apollo Tracing plugin on light themes. The new JSDoc comments for the ITheme interface and the comprehensive rewrite of the theme-customization.md guide are excellent enhancements that will greatly benefit developers. The CSS changes correctly use theme variables to ensure compatibility. However, I've identified a critical issue with the newly added test file, where the tests are not validating the actual implementation, which could lead to a false sense of security. I've also pointed out a small omission in the new documentation to make it even more complete.

Comment on lines +6 to +210
describe('Apollo Tracing Plugin Theme Compatibility', () => {
describe('CSS Variables Usage', () => {
it('should use theme-font-color for text visibility', () => {
// Read the CSS file content
const cssContent = `
.tracing-row {
color: var(--theme-font-color, white);
}
.tracing-row__name {
color: var(--theme-font-color, white);
}
`;

// Verify that theme-font-color is used
expect(cssContent).toContain('var(--theme-font-color');

// Verify fallback is provided
expect(cssContent).toContain('white)');
});

it('should use theme-off-font-color for secondary text', () => {
const cssContent = `
.tracing-row__duration {
color: var(--theme-off-font-color, gray);
}
`;

expect(cssContent).toContain('var(--theme-off-font-color');
});

it('should use primary-color for visual elements', () => {
const cssContent = `
.tracing-row__bar {
background: var(--primary-color, white);
}
`;

expect(cssContent).toContain('var(--primary-color');
});

it('should use theme-bg-color for background contrast', () => {
const cssContent = `
.tracing-row__name-wrapper {
background: var(--theme-bg-color, transparent);
}
`;

expect(cssContent).toContain('var(--theme-bg-color');
});
});

describe('Light Theme Compatibility', () => {
it('should have readable text on light backgrounds', () => {
// Simulate light theme CSS variables
const lightThemeVars = {
'--theme-bg-color': '#fafafa',
'--theme-font-color': '#201e1f', // Dark text
'--theme-off-font-color': '#a6a6a6',
'--primary-color': '#64CB29',
};

// Verify contrast between background and text
const bgLightness = 98; // #fafafa is very light
const fontLightness = 12; // #201e1f is very dark

// Should have good contrast (difference > 50)
expect(Math.abs(bgLightness - fontLightness)).toBeGreaterThan(50);
});

it('should ensure tracing row names are visible on light theme', () => {
// Light theme uses dark text
const fontColor = '#201e1f';
const backgroundColor = '#fafafa';

// These should be sufficiently different
expect(fontColor).not.toBe(backgroundColor);

// Dark text (low RGB values) on light background (high RGB values)
expect(fontColor.toLowerCase()).toContain('20'); // Dark
expect(backgroundColor.toLowerCase()).toContain('fa'); // Light
});
});

describe('Dark Theme Compatibility', () => {
it('should have readable text on dark backgrounds', () => {
// Simulate dark theme CSS variables
const darkThemeVars = {
'--theme-bg-color': '#201e1f',
'--theme-font-color': '#ffffff', // Light text
'--theme-off-font-color': '#f0f0f0',
'--primary-color': '#64CB29',
};

// Verify contrast between background and text
const bgLightness = 12; // #201e1f is very dark
const fontLightness = 100; // #ffffff is white

// Should have excellent contrast (difference = 88)
expect(Math.abs(bgLightness - fontLightness)).toBeGreaterThan(50);
});

it('should ensure tracing row names are visible on dark theme', () => {
// Dark theme uses light text
const fontColor = '#ffffff';
const backgroundColor = '#201e1f';

// These should be sufficiently different
expect(fontColor).not.toBe(backgroundColor);

// Light text (high RGB values) on dark background (low RGB values)
expect(fontColor.toLowerCase()).toBe('#ffffff');
expect(backgroundColor.toLowerCase()).toContain('20'); // Dark
});
});

describe('Background Padding for Text Contrast', () => {
it('should add background to name wrapper for better visibility', () => {
const cssContent = `
.tracing-row__name-wrapper {
background: var(--theme-bg-color, transparent);
padding-right: 8px;
padding-left: 4px;
border-radius: 2px;
}
`;

// Should have background
expect(cssContent).toContain('background:');

// Should have padding for spacing
expect(cssContent).toContain('padding-right:');
expect(cssContent).toContain('padding-left:');

// Should have border-radius for polish
expect(cssContent).toContain('border-radius:');
});
});

describe('Visual Element Opacity', () => {
it('should use opacity for better visibility across themes', () => {
const cssContent = `
.tracing-row__bar {
opacity: 0.9;
}
`;

// Bar should have slight opacity for better blending
expect(cssContent).toContain('opacity:');
});
});

describe('Fallback Values', () => {
it('should provide appropriate fallback colors', () => {
const cssRules = [
{ selector: '.tracing-row', property: 'color', fallback: 'white' },
{ selector: '.tracing-row__bar', property: 'background', fallback: 'white' },
{ selector: '.tracing-row__duration', property: 'color', fallback: 'gray' },
];

cssRules.forEach(rule => {
const cssContent = `
${rule.selector} {
${rule.property}: var(--some-var, ${rule.fallback});
}
`;

expect(cssContent).toContain(rule.fallback);
});
});
});

describe('CSS Class Structure', () => {
it('should have proper BEM naming convention', () => {
const classNames = [
'tracing-row',
'tracing-row__name-wrapper',
'tracing-row__name',
'tracing-row__bar',
'tracing-row__duration',
];

classNames.forEach(className => {
// All class names should follow BEM pattern
expect(className).toMatch(/^[a-z-]+(__[a-z-]+)?$/);
});
});

it('should organize styles hierarchically', () => {
const styles = [
'.tracing-wrapper', // Parent
'.tracing-rows', // Child
'.tracing-row', // Grandchild
'.tracing-row__name-wrapper', // Element
'.tracing-row__name', // Element
];

// All styles should be defined
styles.forEach(style => {
expect(style).toBeTruthy();
expect(style).toMatch(/^\./);
});
});
});
});

Choose a reason for hiding this comment

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

critical

While adding tests is a great step, the current implementation of these tests is unfortunately ineffective. They are testing hardcoded strings and values within the test file itself, rather than verifying the actual styles from tracing.css or the behavior of the component.

For example:

  • The tests define cssContent as a local string variable and assert against it. This means the tests are completely decoupled from the actual CSS file and will pass even if tracing.css is incorrect or empty.
  • The theme compatibility tests assert against hardcoded numbers (bgLightness = 98) rather than calculating contrast from actual color values.

This approach provides a false sense of security.

Recommendation:
The tests should be rewritten to test the real implementation. Since you're using a jsdom environment, you can:

  1. Create a DOM element for the component.
  2. Load the actual tracing.css stylesheet into the test environment.
  3. Use window.getComputedStyle() to get the actual styles applied to the element.
  4. Assert that the computed styles are correct (e.g., expect(computedStyle.color).toBe('var(--theme-font-color)')).

This will ensure your tests are validating the real behavior and will catch regressions in the future.

Comment on lines +188 to +196
| Comments | `editor.colors.comment` | `--editor-comment-color` | `# This is a comment` |
| Strings | `editor.colors.string` | `--editor-string-color` | `"Hello World"` |
| Numbers | `editor.colors.number` | `--editor-number-color` | `123`, `45.67` |
| Keywords | `editor.colors.keyword` | `--editor-keyword-color` | `query`, `mutation`, `fragment` |
| Variables | `editor.colors.variable` | `--editor-variable-color` | `$userId`, field names |
| Directives | `editor.colors.attribute` | `--editor-attribute-color` | `@include`, `@skip` |
| Properties | `editor.colors.property` | `--editor-property-color` | Field names in responses |
| Punctuation | `editor.colors.punctuation` | `--editor-punctuation-color` | `{ } [ ] ( ) , :` |
| Booleans | `editor.colors.atom` | `--editor-atom-color` | `true`, `false`, `null` |

Choose a reason for hiding this comment

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

medium

This visual mapping guide is very helpful! However, the 'Code Editor Syntax' table appears to be incomplete. It's missing the following properties which are defined in the ITheme interface and mentioned in the list starting on line 49:

  • editor.colors.definition
  • editor.colors.builtin
  • editor.colors.cursor

To ensure the documentation is comprehensive and consistent with the interface, please consider adding these to the table.

Suggested change
| Comments | `editor.colors.comment` | `--editor-comment-color` | `# This is a comment` |
| Strings | `editor.colors.string` | `--editor-string-color` | `"Hello World"` |
| Numbers | `editor.colors.number` | `--editor-number-color` | `123`, `45.67` |
| Keywords | `editor.colors.keyword` | `--editor-keyword-color` | `query`, `mutation`, `fragment` |
| Variables | `editor.colors.variable` | `--editor-variable-color` | `$userId`, field names |
| Directives | `editor.colors.attribute` | `--editor-attribute-color` | `@include`, `@skip` |
| Properties | `editor.colors.property` | `--editor-property-color` | Field names in responses |
| Punctuation | `editor.colors.punctuation` | `--editor-punctuation-color` | `{ } [ ] ( ) , :` |
| Booleans | `editor.colors.atom` | `--editor-atom-color` | `true`, `false`, `null` |
| Comments | `editor.colors.comment` | `--editor-comment-color` | `# This is a comment` |
| Strings | `editor.colors.string` | `--editor-string-color` | `"Hello World"` |
| Numbers | `editor.colors.number` | `--editor-number-color` | `123`, `45.67` |
| Keywords | `editor.colors.keyword` | `--editor-keyword-color` | `query`, `mutation`, `fragment` |
| Variables | `editor.colors.variable` | `--editor-variable-color` | `$userId`, field names |
| Directives | `editor.colors.attribute` | `--editor-attribute-color` | `@include`, `@skip` |
| Properties | `editor.colors.property` | `--editor-property-color` | Field names in responses |
| Punctuation | `editor.colors.punctuation` | `--editor-punctuation-color` | `{ } [ ] ( ) , :` |
| Booleans | `editor.colors.atom` | `--editor-atom-color` | `true`, `false`, `null` |
| Definitions | `editor.colors.definition` | `--editor-def-color` | Type/operation names |
| Built-ins | `editor.colors.builtin` | `--editor-builtin-color` | `String`, `Int`, `Boolean` |
| Cursor | `editor.colors.cursor` | `--editor-cursor-color` | The blinking text cursor |

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19931bd and c78459a.

📒 Files selected for processing (4)
  • packages/altair-core/src/theme/theme.ts (2 hunks)
  • packages/altair-docs/docs/features/theme-customization.md (2 hunks)
  • plugins/apollo-tracing/src/components/Tracing/tracing.css (2 hunks)
  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{md,mdx}

📄 CodeRabbit inference engine (.github/instructions/documentation.instructions.md)

**/*.{md,mdx}: Provide working code examples in documentation
Organize documentation by feature and user journey
Include getting started guides and tutorials
Provide troubleshooting and FAQ sections
Use clear, concise language
Follow consistent terminology throughout documentation
Write for the target audience (developers, end users)
Use active voice and present tense
Provide complete, working code examples
Test all code examples to ensure they work
Use realistic, relevant examples
Include both basic and advanced usage patterns
Use clear headings and subheadings
Organize content logically from basic to advanced
Use bullet points and numbered lists for clarity
Include a table of contents for long documents
Document all public functions and classes with parameter types, descriptions, return values, exceptions, and usage examples
Document all public interfaces and types with purpose, usage context, examples, and constraints
Explain features from the user's perspective
Include step-by-step instructions with screenshots in user guides
Cover common use cases and workflows
Provide troubleshooting tips in feature docs
Create migration guides for breaking changes with before/after examples and reasoning; include automated tools when possible
Document the development environment setup, prerequisites, and troubleshooting
Keep development setup instructions up to date
Document coding standards, architecture decisions, and examples of good/bad practices; reference automated tools
Release notes should highlight major features, include upgrade instructions, mention breaking changes, and link to detailed docs
Update examples to match current API
Remove outdated information from docs
Fix broken links and references
Use inclusive, accessible language; avoid jargon when possible; define technical terms; consider non-native English speakers
Use proper heading hierarchy for visual accessibility
Include alt text for images and screenshots
Ensure sufficient color contrast in embedded vi...

Files:

  • packages/altair-docs/docs/features/theme-customization.md
packages/altair-docs/**/*.{md,ts}

📄 CodeRabbit inference engine (.github/instructions/main.instructions.md)

Author documentation with VitePress in packages/altair-docs

Files:

  • packages/altair-docs/docs/features/theme-customization.md
**/*.ts

📄 CodeRabbit inference engine (.github/instructions/app-testing.instructions.md)

Follow project code style using ESLint and Prettier

**/*.ts: Use explicit type annotations for function parameters and return types
Prefer interfaces over type aliases for object shapes
Use union types and literal types for better type safety
Leverage generic types for reusable components
Group imports: external libraries first, then internal modules
Use absolute imports from package roots when possible
Prefer named exports over default exports
Use custom error classes that extend Error
Implement proper error boundaries and handling
Log errors with sufficient context for debugging
Use observables (RxJS) for reactive programming patterns where appropriate
Manage subscriptions to avoid memory leaks
Use appropriate RxJS operators for data transformation
Handle errors in observable streams
Use async/await for sequential operations
Handle promise rejections properly
Use Promise.all() for concurrent operations
Implement timeout handling for long-running operations
Dispose of resources properly (subscriptions, event listeners)
Use weak references where appropriate
Avoid creating unnecessary objects in hot paths
Profile memory usage for performance-critical code
Use tree-shaking-friendly imports
Lazy load heavy modules when possible
Monitor bundle size impacts of new dependencies
Use dynamic imports for code splitting
Validate and sanitize all user inputs
Implement proper XSS and injection prevention
Validate API responses before processing
Sanitize sensitive data in logs
Follow secure coding practices
Group related functionality in modules
Keep files focused and not too large
Use consistent naming conventions
Organize imports and exports clearly
Write JSDoc comments for public APIs
Keep documentation up to date with code changes (inline docs)
Use meaningful variable and function names
Handle environment-specific APIs properly
Use TypeScript features appropriate for the configured version

Files:

  • packages/altair-core/src/theme/theme.ts
  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/instructions/main.instructions.md)

Use TypeScript for implementation across the codebase

Files:

  • packages/altair-core/src/theme/theme.ts
  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
packages/altair-core/**/*.ts

📄 CodeRabbit inference engine (.github/instructions/main.instructions.md)

Modify shared logic/types/utilities in packages/altair-core carefully, as changes impact multiple packages; ensure thorough testing

Files:

  • packages/altair-core/src/theme/theme.ts
{**/__tests__/**/*.ts,**/*.{spec,test}.ts}

📄 CodeRabbit inference engine (.github/instructions/app-testing.instructions.md)

{**/__tests__/**/*.ts,**/*.{spec,test}.ts}: Use Jest as the testing framework for all tests
Organize tests next to the code under test: use a tests folder or .test.ts/.spec.ts files alongside sources
Use clear, descriptive test names explaining what is being verified
Mock dependencies with Jest to isolate the unit under test
Leverage TypeScript types in tests; define interfaces/types for expected data shapes

Files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
**/*.{spec,test}.{ts,tsx,js}

📄 CodeRabbit inference engine (.github/instructions/main.instructions.md)

Write and maintain tests; Jest is used for most testing

Files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
**/*.{test,spec}.{ts,js}

📄 CodeRabbit inference engine (.github/instructions/testing.instructions.md)

**/*.{test,spec}.{ts,js}: Follow the Arrange-Act-Assert (AAA) pattern in tests
Write descriptive test names that explain expected behavior
Keep tests focused and independent
Use consistent naming conventions across all test files
Group related tests using describe blocks
Use nested describe blocks for different methods or scenarios
Place setup code in beforeEach or beforeAll hooks
Clean up resources in afterEach or afterAll hooks
Mock external dependencies to isolate units under test
Use Jest's mocking capabilities effectively
Create reusable mock factories for common dependencies
Verify interactions with mocked dependencies when necessary
Use async/await for testing promises
Test both success and error scenarios in async code
Handle timeouts appropriately in async tests
Test concurrent operations when relevant
For NestJS controllers, test HTTP handling, response formatting, auth, and error/status codes; mock service dependencies
For NestJS services, test business logic, data transformations, error handling/validation, and verify logging/monitoring calls
For API integration tests, test endpoints end-to-end, use test DB/transactions, test auth flows, and verify API contracts/responses
For browser extensions, mock browser APIs (chrome., browser.), test message passing, content scripts, and verify manifest configuration
Write performance tests for critical code paths and set performance budgets/thresholds
Monitor test execution times and profile memory usage in tests
Load test API endpoints, verify graceful degradation, check for resource cleanup/memory leaks, and monitor performance metrics
E2E tests should focus on critical user journeys, use realistic data, test cross-browser, and verify integrations
Use dedicated test environments, mock external services appropriately, ensure data consistency, and clean up test artifacts
Create reusable test data factories and use realistic but anonymized data; version fixtures with code and clean up after tests
Maintain high t...

Files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
**/*.{spec,test}.ts

📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)

**/*.{spec,test}.ts: Write unit tests focusing on business logic and behavior
Use descriptive test names
Mock external dependencies appropriately in tests
Test edge cases and error conditions

Files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
🧠 Learnings (21)
📚 Learning: 2025-10-03T16:39:27.517Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/main.instructions.md:0-0
Timestamp: 2025-10-03T16:39:27.517Z
Learning: Applies to packages/altair-core/**/*.ts : Modify shared logic/types/utilities in packages/altair-core carefully, as changes impact multiple packages; ensure thorough testing

Applied to files:

  • packages/altair-docs/docs/features/theme-customization.md
  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-10-03T16:40:52.954Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/nestjs-api.instructions.md:0-0
Timestamp: 2025-10-03T16:40:52.954Z
Learning: Applies to packages/altair-api/src/**/*.controller.ts : Keep API documentation up to date with endpoints

Applied to files:

  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-10-03T16:41:45.498Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/testing.instructions.md:0-0
Timestamp: 2025-10-03T16:41:45.498Z
Learning: Applies to packages/altair-app/**/*.{test,spec}.ts : In components, test methods, business logic, event emissions, state changes, lifecycle, and integration with injected services

Applied to files:

  • packages/altair-core/src/theme/theme.ts
  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:39:27.517Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/main.instructions.md:0-0
Timestamp: 2025-10-03T16:39:27.517Z
Learning: Applies to packages/altair-app/**/*.{ts,html} : Implement and modify the main web app using Angular conventions within packages/altair-app

Applied to files:

  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-10-03T16:40:52.954Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/nestjs-api.instructions.md:0-0
Timestamp: 2025-10-03T16:40:52.954Z
Learning: Applies to packages/altair-api/src/**/*.controller.ts : Use Swagger/OpenAPI decorators for API documentation

Applied to files:

  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-10-03T16:41:45.498Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/testing.instructions.md:0-0
Timestamp: 2025-10-03T16:41:45.498Z
Learning: Applies to packages/altair-app/**/*.{test,spec}.ts : Focus on component business logic rather than UI library behavior

Applied to files:

  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-09-24T19:40:17.905Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/app-testing.instructions.md:0-0
Timestamp: 2025-09-24T19:40:17.905Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts : Test state management and property changes of components

Applied to files:

  • packages/altair-core/src/theme/theme.ts
  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:40:52.954Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/nestjs-api.instructions.md:0-0
Timestamp: 2025-10-03T16:40:52.954Z
Learning: Applies to packages/altair-api/src/config/**/*.ts : Use type-safe configuration classes

Applied to files:

  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-10-13T05:15:52.113Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/angular-components.instructions.md:0-0
Timestamp: 2025-10-13T05:15:52.113Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.component.{ts,html} : Follow existing patterns for modals, forms, and navigation

Applied to files:

  • packages/altair-core/src/theme/theme.ts
📚 Learning: 2025-09-24T19:40:17.905Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/app-testing.instructions.md:0-0
Timestamp: 2025-09-24T19:40:17.905Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts : Do not test CSS styling or visual appearance

Applied to files:

  • packages/altair-core/src/theme/theme.ts
  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-13T05:15:52.113Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/angular-components.instructions.md:0-0
Timestamp: 2025-10-13T05:15:52.113Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.component.spec.ts : Test event emissions, state changes, and method behavior in unit tests

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:39:27.517Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/main.instructions.md:0-0
Timestamp: 2025-10-03T16:39:27.517Z
Learning: Applies to **/*.{spec,test}.{ts,tsx,js} : Write and maintain tests; Jest is used for most testing

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-09-24T19:40:17.905Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/app-testing.instructions.md:0-0
Timestamp: 2025-09-24T19:40:17.905Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts : Test component lifecycle behavior

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:41:45.498Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/testing.instructions.md:0-0
Timestamp: 2025-10-03T16:41:45.498Z
Learning: Applies to packages/altair-app/**/*.{test,spec}.ts : Test component lifecycle methods appropriately

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-09-24T19:40:17.905Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/app-testing.instructions.md:0-0
Timestamp: 2025-09-24T19:40:17.905Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts : Test component business logic and methods

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-09-24T19:40:17.905Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/app-testing.instructions.md:0-0
Timestamp: 2025-09-24T19:40:17.905Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts : Always cover edge cases (null, rapid calls, invalid inputs) in component tests

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-09-24T19:40:17.905Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/app-testing.instructions.md:0-0
Timestamp: 2025-09-24T19:40:17.905Z
Learning: Applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts : Avoid fragile emission index tracking across multiple actions in a single test; isolate scenarios per it block

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:41:45.498Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/testing.instructions.md:0-0
Timestamp: 2025-10-03T16:41:45.498Z
Learning: Applies to **/*.{test,spec}.{ts,js} : Use nested describe blocks for different methods or scenarios

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:38:42.919Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/javascript.instructions.md:0-0
Timestamp: 2025-10-03T16:38:42.919Z
Learning: Applies to **/*.test.{js,mjs,cjs} : Test error conditions and edge cases

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:38:42.919Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/javascript.instructions.md:0-0
Timestamp: 2025-10-03T16:38:42.919Z
Learning: Applies to **/*.test.{js,mjs,cjs} : Use appropriate test frameworks (e.g., Jest, Mocha)

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
📚 Learning: 2025-10-03T16:41:45.498Z
Learnt from: CR
Repo: altair-graphql/altair PR: 0
File: .github/instructions/testing.instructions.md:0-0
Timestamp: 2025-10-03T16:41:45.498Z
Learning: Applies to **/*.{test,spec}.{ts,js} : Group related tests using describe blocks

Applied to files:

  • plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts
🪛 GitHub Check: SonarCloud Code Analysis
plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts

[warning] 61-61: Remove this useless assignment to variable "lightThemeVars".

See more on https://sonarcloud.io/project/issues?id=altair-graphql_altair&issues=AZqtg7Q41NG8ykCp-Gba&open=AZqtg7Q41NG8ykCp-Gba&pullRequest=2938


[warning] 93-93: Remove this useless assignment to variable "darkThemeVars".

See more on https://sonarcloud.io/project/issues?id=altair-graphql_altair&issues=AZqtg7Q41NG8ykCp-Gbb&open=AZqtg7Q41NG8ykCp-Gbb&pullRequest=2938

🪛 LanguageTool
packages/altair-docs/docs/features/theme-customization.md

[style] ~24-~24: To form a complete sentence, be sure to include a subject.
Context: ...imestamps, and less emphasized content. Should be readable but more subtle than font...

(MISSING_IT_THERE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review
🔇 Additional comments (4)
packages/altair-core/src/theme/theme.ts (1)

55-265: Excellent documentation enhancement!

The comprehensive JSDoc comments significantly improve the developer experience by clearly explaining:

  • The purpose of each theme property
  • Associated CSS variables for reference
  • Specific UI locations where properties are applied
  • Practical examples of usage

This documentation aligns perfectly with the PR objectives to improve theme customization understanding and addresses the issue where users had difficulty mapping ITheme properties to UI elements.

Based on learnings: Changes to packages/altair-core should be carefully reviewed as they impact multiple packages. Since these are documentation-only changes with no functional modifications, no additional testing is required.

packages/altair-docs/docs/features/theme-customization.md (1)

11-205: Outstanding documentation expansion!

This comprehensive guide addresses the core issues raised in #2848 by providing:

  1. Clear property explanations - Each theme property now has a detailed description of its purpose and usage
  2. Visual mapping - Tables that map theme properties directly to UI elements, resolving the confusion about what controls what
  3. Accessibility guidance - Practical tips for users with reduced contrast sensitivity to create readable themes
  4. Real-world examples - High contrast dark theme and warm light theme patterns
  5. Editor color mapping - Clear explanation of what each editor color property controls in GraphQL syntax

The structured approach (Background, Text, Border, Brand colors) makes it easy to understand the theme system's organization. The CSS variable references alongside theme properties are particularly helpful for advanced customization.

Note: The static analysis hint about line 24 is a false positive - the sentence structure is correct.

plugins/apollo-tracing/src/components/Tracing/tracing.css (1)

51-79: Effective theme compatibility improvements!

These CSS updates directly address the Apollo Tracing plugin's light theme rendering issues mentioned in #2848. The changes demonstrate good practices:

  1. Background contrast (lines 52-55) - Adding theme-bg-color background with padding and border-radius ensures text remains readable regardless of theme
  2. Primary text color (line 62) - Using theme-font-color ensures proper visibility in both light and dark themes
  3. Reduced opacity (line 73) - The 0.9 opacity on the bar improves visibility across varied backgrounds
  4. Muted secondary text (line 79) - Using theme-off-font-color appropriately distinguishes duration text

All CSS variables include sensible fallback values, ensuring graceful degradation if variables aren't available.

plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts (1)

1-210: Remove the suggestion to follow CSS testing restrictions; they don't apply to this plugin.

The review incorrectly cites a coding guideline that applies only to Angular components in packages/altair-app/. The rule "Do not test CSS styling or visual appearance" is explicitly documented under the "Angular Component Testing" section of app-testing.instructions.md and applies to packages/altair-app/src/app/modules/altair/components/**/*.spec.ts.

This test file (plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts) is in a React plugin, not an Angular component in packages/altair-app. The guideline does not apply.

That said, the substantive point about hardcoded CSS strings is worth considering: the tests verify hardcoded snippets rather than reading the actual tracing.css file. However, this is a stylistic choice, not a requirement. The hardcoded strings in the tests match the actual CSS file accurately, so the tests do verify the expected CSS variable usage, just not by loading the file directly.

Likely an incorrect or invalid review comment.

Comment on lines +61 to +66
const lightThemeVars = {
'--theme-bg-color': '#fafafa',
'--theme-font-color': '#201e1f', // Dark text
'--theme-off-font-color': '#a6a6a6',
'--primary-color': '#64CB29',
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused variable lightThemeVars.

The variable is defined but never used in the test. If you intended to apply these CSS variables to test actual theme rendering, consider using a proper DOM testing approach with the variables actually applied.

-    it('should have readable text on light backgrounds', () => {
-      // Simulate light theme CSS variables
-      const lightThemeVars = {
-        '--theme-bg-color': '#fafafa',
-        '--theme-font-color': '#201e1f', // Dark text
-        '--theme-off-font-color': '#a6a6a6',
-        '--primary-color': '#64CB29',
-      };
-      
+    it('should have readable text on light backgrounds', () => {
       // Verify contrast between background and text
       const bgLightness = 98; // #fafafa is very light
       const fontLightness = 12; // #201e1f is very dark

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis

[warning] 61-61: Remove this useless assignment to variable "lightThemeVars".

See more on https://sonarcloud.io/project/issues?id=altair-graphql_altair&issues=AZqtg7Q41NG8ykCp-Gba&open=AZqtg7Q41NG8ykCp-Gba&pullRequest=2938

🤖 Prompt for AI Agents
In plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts around lines 61
to 66, the test defines a constant lightThemeVars that is never used; remove the
unused variable (or, if the intent was to test theme rendering, apply those CSS
variables to the test DOM and assert rendered styles). Update the test by
deleting the unused lightThemeVars declaration to eliminate dead code, or
alternatively inject the variables into the test container (e.g., set style
properties on document.documentElement or the rendered element) and add
assertions verifying the applied styles.

Comment on lines +93 to +98
const darkThemeVars = {
'--theme-bg-color': '#201e1f',
'--theme-font-color': '#ffffff', // Light text
'--theme-off-font-color': '#f0f0f0',
'--primary-color': '#64CB29',
};
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused variable darkThemeVars.

Similar to the light theme test, this variable is defined but never used.

-    it('should have readable text on dark backgrounds', () => {
-      // Simulate dark theme CSS variables
-      const darkThemeVars = {
-        '--theme-bg-color': '#201e1f',
-        '--theme-font-color': '#ffffff', // Light text
-        '--theme-off-font-color': '#f0f0f0',
-        '--primary-color': '#64CB29',
-      };
-      
+    it('should have readable text on dark backgrounds', () => {
       // Verify contrast between background and text
       const bgLightness = 12; // #201e1f is very dark
       const fontLightness = 100; // #ffffff is white
📝 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
const darkThemeVars = {
'--theme-bg-color': '#201e1f',
'--theme-font-color': '#ffffff', // Light text
'--theme-off-font-color': '#f0f0f0',
'--primary-color': '#64CB29',
};
it('should have readable text on dark backgrounds', () => {
// Verify contrast between background and text
const bgLightness = 12; // #201e1f is very dark
const fontLightness = 100; // #ffffff is white
🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis

[warning] 93-93: Remove this useless assignment to variable "darkThemeVars".

See more on https://sonarcloud.io/project/issues?id=altair-graphql_altair&issues=AZqtg7Q41NG8ykCp-Gbb&open=AZqtg7Q41NG8ykCp-Gbb&pullRequest=2938

🤖 Prompt for AI Agents
In plugins/apollo-tracing/src/components/Tracing/tracing.spec.ts around lines 93
to 98, the test defines a darkThemeVars constant that is never used; remove the
unused darkThemeVars declaration to clean up the test (or if it was intended to
be used, replace references to the light theme with this darkThemeVars where
appropriate) and run the test suite to ensure no regressions.

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.

Guidelines/help for custom themes

1 participant