Skip to content

Adjust diff comment token color#2522

Merged
Kitenite merged 3 commits into
superset-sh:mainfrom
Kitenite:kitenite/fix-the-diffs-colo
Mar 17, 2026
Merged

Adjust diff comment token color#2522
Kitenite merged 3 commits into
superset-sh:mainfrom
Kitenite:kitenite/fix-the-diffs-colo

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Mar 16, 2026

Summary

  • blend diff comment syntax toward the editor foreground instead of using the base muted comment token
  • keep the change scoped to the diff theme so the main editor theme stays unchanged
  • add a small test covering dark and light theme behavior

Testing

  • bun --cwd apps/desktop test src/renderer/screens/main/components/WorkspaceView/utils/code-theme/diff-theme.test.ts
  • bun run --cwd apps/desktop typecheck

Summary by cubic

Blend diff comment tokens toward the editor foreground for better readability in diffs, using LAB interpolation (0.22) and computing the blend once per theme via getDiffCommentColor. Added partial editor overrides and an explicit editor comment color in the ember theme so diff comments render consistently.

  • Refactors
    • Introduced EditorThemeOverrides and updated Theme.editor to accept partial colors/syntax.
    • Refined theme tests and importer expectations to honor explicit editor comment colors and align editor.colors.searchActive with ui.highlightActive.

Written for commit f0a52ed. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Added comment color customization to the Ember dark theme for finer syntax highlighting.
    • Added support for partial editor theme overrides, allowing selective editor color/syntax changes without full theme replacements.
  • Tests

    • Updated tests to cover explicit comment color handling, fallback behavior when editor overrides are omitted, and import/override interactions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 12745a01-88d4-43fe-bbe9-b1a6345b6e5a

📥 Commits

Reviewing files that changed from the base of the PR and between fc640a0 and f0a52ed.

📒 Files selected for processing (1)
  • apps/desktop/src/shared/themes/editor.test.ts

📝 Walkthrough

Walkthrough

Adds an editor comment color to the Ember dark theme, introduces EditorThemeOverrides for partial editor overrides and updates Theme.editor to that type, and adjusts tests to assert the new comment color and use optional chaining / fallback behavior for editor properties.

Changes

Cohort / File(s) Summary
Theme Configuration
apps/desktop/src/shared/themes/built-in/ember.ts
Adds editor.syntax.comment color (#a8a5a3) to the darkTheme export.
Type Definitions
apps/desktop/src/shared/themes/types.ts
Adds EditorThemeOverrides (colors?: Partial<EditorColors>; syntax?: Partial<EditorSyntaxColors>) and changes Theme.editor from EditorTheme to EditorThemeOverrides.
Tests
apps/desktop/src/shared/themes/editor.test.ts, apps/desktop/src/shared/themes/import.test.ts
Updates tests to read editor?.syntax?.comment, assert the explicit comment value, use optional chaining for editor color accesses, and verify fallback behavior when editor is omitted.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through themes in search of light,
A tiny comment turned the dark more bright.
Partial colors tucked in gentle rows,
Tests nod approving where the new value goes. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title accurately reflects the main change: adjusting the diff comment token color to blend toward the editor foreground, which is the primary focus of the PR.
Description check ✅ Passed The PR description covers the key changes (blending comment tokens, scoping to diff theme, adding tests), testing steps, and includes both manual and auto-generated summaries explaining the modifications.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-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.

No issues found across 2 files

Copy link
Copy Markdown
Contributor

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

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/utils/code-theme/diff-theme.ts (1)

40-40: Optional: avoid recomputing editor theme in the same path.

Line 40 calls getDiffCommentColor(theme), which recomputes getEditorTheme(theme) after Line 39 already computed it. This is minor, but easy to simplify.

♻️ Proposed refactor
+function blendDiffCommentColor(comment: string, foreground: string): string {
+	const mixedColor = interpolate([comment, foreground], "lab")(
+		DIFF_COMMENT_FOREGROUND_BLEND,
+	);
+	const rgbColor = toRgb(mixedColor);
+	return rgbColor ? formatHex(rgbColor) : toHex(comment);
+}
+
 export function getDiffCommentColor(theme: Theme): string {
 	const editorTheme = getEditorTheme(theme);
-	const mixedColor = interpolate(
-		[editorTheme.syntax.comment, editorTheme.colors.foreground],
-		"lab",
-	)(DIFF_COMMENT_FOREGROUND_BLEND);
-	const rgbColor = toRgb(mixedColor);
-
-	return rgbColor ? formatHex(rgbColor) : toHex(editorTheme.syntax.comment);
+	return blendDiffCommentColor(
+		editorTheme.syntax.comment,
+		editorTheme.colors.foreground,
+	);
 }
 
 function createShikiTheme(theme: Theme) {
 	const editorTheme = getEditorTheme(theme);
-	const diffCommentColor = getDiffCommentColor(theme);
+	const diffCommentColor = blendDiffCommentColor(
+		editorTheme.syntax.comment,
+		editorTheme.colors.foreground,
+	);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/utils/code-theme/diff-theme.ts`
at line 40, The code calls getDiffCommentColor(theme) which internally
recomputes getEditorTheme(theme) even though you already compute editorTheme;
refactor to compute const editorTheme = getEditorTheme(theme) once and then
either change getDiffCommentColor to accept editorTheme (e.g.,
getDiffCommentColor(editorTheme)) or call a helper that uses the existing
editorTheme, then assign diffCommentColor from that to avoid redundant
getEditorTheme calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/utils/code-theme/diff-theme.ts`:
- Line 40: The code calls getDiffCommentColor(theme) which internally recomputes
getEditorTheme(theme) even though you already compute editorTheme; refactor to
compute const editorTheme = getEditorTheme(theme) once and then either change
getDiffCommentColor to accept editorTheme (e.g.,
getDiffCommentColor(editorTheme)) or call a helper that uses the existing
editorTheme, then assign diffCommentColor from that to avoid redundant
getEditorTheme calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2e50a098-9d73-46a5-8e42-66db238b9e4b

📥 Commits

Reviewing files that changed from the base of the PR and between ba6fcdd and d23ef0d.

📒 Files selected for processing (2)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/utils/code-theme/diff-theme.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/utils/code-theme/diff-theme.ts

Copy link
Copy Markdown
Contributor

@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 (1)
apps/desktop/src/main/terminal-host/session-lifecycle.test.ts (1)

50-54: Duplicate describeWithTimeout definition.

This is identical to the wrapper in daemon.test.ts. As mentioned in the other file, consider extracting this to test-helpers.ts alongside supportsLocalSocketBinding to reduce duplication and centralize test configuration.

♻️ Suggested shared utility in test-helpers.ts
// In test-helpers.ts
import { describe } from "bun:test";

export const describeWithTimeout = describe as unknown as (
	label: string,
	options: { timeout: number },
	body: () => void,
) => void;

// Common timeout for integration tests
export const INTEGRATION_TEST_TIMEOUT = 15000;

Then import in both test files:

import { describeWithTimeout, INTEGRATION_TEST_TIMEOUT, supportsLocalSocketBinding } from "./test-helpers";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/src/main/terminal-host/session-lifecycle.test.ts` around lines
50 - 54, The duplicate describeWithTimeout definition should be extracted into a
shared test helper; create a new test-helpers.ts exporting describeWithTimeout
(the cast wrapper), INTEGRATION_TEST_TIMEOUT, and supportsLocalSocketBinding,
then remove the local duplicate from session-lifecycle.test.ts and
daemon.test.ts and import describeWithTimeout and INTEGRATION_TEST_TIMEOUT (and
supportsLocalSocketBinding if needed) from "./test-helpers" so both tests reuse
the single definition.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/desktop/src/main/terminal-host/daemon.test.ts`:
- Around line 47-51: The custom casted describeWithTimeout wrapper around
describe is invalid for bun:test and silently drops the timeout; remove
describeWithTimeout and replace its usages with the native describe (or plain
describe blocks) and set timeouts on individual tests (use test(name, fn,
timeoutMs)) or configure a global timeout in bunfig.toml ([test] timeout =
15000); update any references to describeWithTimeout in tests to either call
describe(...) and set timeouts on contained test(...) calls or move timeout
configuration to bunfig.toml.

---

Nitpick comments:
In `@apps/desktop/src/main/terminal-host/session-lifecycle.test.ts`:
- Around line 50-54: The duplicate describeWithTimeout definition should be
extracted into a shared test helper; create a new test-helpers.ts exporting
describeWithTimeout (the cast wrapper), INTEGRATION_TEST_TIMEOUT, and
supportsLocalSocketBinding, then remove the local duplicate from
session-lifecycle.test.ts and daemon.test.ts and import describeWithTimeout and
INTEGRATION_TEST_TIMEOUT (and supportsLocalSocketBinding if needed) from
"./test-helpers" so both tests reuse the single definition.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2f19091e-1039-475b-a96a-dfd25669c72e

📥 Commits

Reviewing files that changed from the base of the PR and between d23ef0d and 315476b.

📒 Files selected for processing (2)
  • apps/desktop/src/main/terminal-host/daemon.test.ts
  • apps/desktop/src/main/terminal-host/session-lifecycle.test.ts

Comment thread apps/desktop/src/main/terminal-host/daemon.test.ts Outdated
@Kitenite Kitenite force-pushed the kitenite/fix-the-diffs-colo branch from ae31b72 to fc640a0 Compare March 17, 2026 07:30
@Kitenite Kitenite merged commit 71df806 into superset-sh:main Mar 17, 2026
5 of 7 checks passed
@Kitenite Kitenite deleted the kitenite/fix-the-diffs-colo branch March 17, 2026 09:03
z3thon pushed a commit to z3thon/superset that referenced this pull request Mar 19, 2026
* Update colors

* Refine theme tests

* Lint
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