Skip to content

added an option to change text color in consoleDriver window#4433

Merged
shahanemahesh merged 2 commits into
masterfrom
Feature/ColorSelectionOnConsoleDriver
Feb 17, 2026
Merged

added an option to change text color in consoleDriver window#4433
shahanemahesh merged 2 commits into
masterfrom
Feature/ColorSelectionOnConsoleDriver

Conversation

@omri1911

@omri1911 omri1911 commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Type of Change

  • Bug fix - [ ] New feature - [ ] Breaking change - [ ] Plugin update

Checklist

  • PR description clearly describes the changes
  • Target branch is correct (master for features, Releases/* for fixes)
  • Latest code from target branch merged
  • No commented/junk code included
  • No new build warnings or errors
  • All existing unit tests pass
  • New unit tests added for new functionality
  • Cross-platform compatibility verified (Windows/Linux/macOS)
  • CI/CD pipeline passes
  • Code follows project conventions (Act{Platform}{Type}, {Platform}Driver)
  • Repository objects use [IsSerializedForLocalRepository] where needed
  • Error handling uses Reporter.ToLog() pattern
  • Documentation updated for user-facing changes
  • Self-review completed and code review comments addressed

Summary by CodeRabbit

  • New Features
    • Added a text color customization button to the console action bar, enabling users to personalize their console text appearance
    • Three color options available: Green, White, and Blue, accessible through the new color button with cycling functionality
    • Console text color selections automatically persist when switching between light and dark application themes

@coderabbitai

coderabbitai Bot commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce a color customization feature for console text in the ConsoleDriverWindow. The XAML file adopts enum-based bindings for type safety and adds a ColorButton control to the action bar. The code-behind implements color palette cycling, applies selected colors to console text and related brushes, integrates color choices with theme switching, and modifies console output rendering to preserve text color formatting.

Changes

Cohort / File(s) Summary
XAML Enum Namespace and ColorButton UI
ConsoleDriverWindow.xaml
Adds Enums namespace alias, replaces literal ImageType values with type-safe enum bindings, and introduces ColorButton control for text color selection.
Console Text Color Feature Implementation
ConsoleDriverWindow.xaml.cs
Adds color palette management (Green, White, Blue), implements ApplyConsoleTextColor() method to apply colors to console text foreground and RichTextBox formatting, adds ColorButton_Click() event handler for color cycling, integrates color persistence into theme methods (ApplyDarkTheme/ApplyLightTheme), and updates console rendering to use ConsoleWriteText with format preservation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • D57008_D57038 Defect fixed #4366: Modifies the same ConsoleDriverWindow.xaml.cs class for driver-close handling and cleanup logic, sharing similar domain focus on console window lifecycle management.

Suggested reviewers

  • Maheshkale447

Poem

🐰✨ A rainbow for the console so bright,
Where text can dance in green or white,
The driver window now has flair,
With colors floating through the air!
Hop, click, and watch it all appear! 🌈

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is entirely empty except for the template structure; no actual implementation details, rationale, or testing information are provided. Fill in the Description section with details about the feature, mark the Type of Change, and verify checklist items to demonstrate the PR meets repository standards.
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 (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a color customization option for console text in the ConsoleDriver window.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Feature/ColorSelectionOnConsoleDriver

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.

@shahanemahesh
shahanemahesh marked this pull request as ready for review February 9, 2026 13:54

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml.cs (1)

598-601: 🧹 Nitpick | 🔵 Trivial

ColorButton is excluded from the foreach loop that styles all toolbar buttons.

ColorButton is handled separately with a null check (Lines 602-608, 654-660), but it duplicates the same styling logic. Including it in the array would be simpler and less error-prone.

Proposed refactor
-            foreach (var b in new[] { RecordButton, NewActionButton, ThemeToggleButton, GoButton, TopButton })
+            foreach (var b in new[] { RecordButton, NewActionButton, ThemeToggleButton, GoButton, TopButton, ColorButton })
             {
                 b.Style = roundStyle; b.Background = btnBG; b.BorderBrush = btnBorder; b.Foreground = btnText;
             }
-            if (ColorButton != null)
-            {
-                ColorButton.Style = roundStyle;
-                ColorButton.Background = btnBG;
-                ColorButton.BorderBrush = btnBorder;
-                ColorButton.Foreground = btnText;
-            }

Apply in both ApplyDarkTheme and ApplyLightTheme.

Also applies to: 652-653

🤖 Fix all issues with AI agents
In `@Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml`:
- Line 102: Replace the plain Content of ColorButton with the same structured
XAML the other toolbar buttons use: create an inline StackPanel containing an
ImageMakerControl (or a small Ellipse/colored dot matching the runtime colored
swatch) and a TextBlock label so the initial visual matches what
ApplyConsoleTextColor/InitializeCommonUI will set at runtime; keep the existing
x:Name="ColorButton", Click="ColorButton_Click", Style, Margin and tooltips, and
ensure the inline content uses the same sizing/margins as sibling buttons so
first-paint appearance is consistent with the other controls.

In `@Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml.cs`:
- Line 34: Remove the unused using directive `using System.Windows.Markup;` from
the top of ConsoleDriverWindow.xaml.cs (it’s not referenced anywhere in the
file); update any usings ordering if needed and run a build/IDE cleanup to
ensure no other references depend on `System.Windows.Markup`.
- Around line 76-90: Replace the fragile parallel arrays _consoleTextPalette and
_consoleTextPaletteNames with a single structured collection (e.g., an array or
list of a small record/struct or tuple like { Color, Name }) and update uses to
read the color and name from that single collection using
_consoleTextPalette[_consoleTextPaletteIndex].Color and .Name; update any code
that references the old arrays (including _consoleTextPaletteIndex) to use the
new combined type so the palette and its label cannot fall out of sync.
- Around line 73-74: The init-time cast in InitTextBlocks that sets _colorText
is invalid because ColorButton.Content starts as a string and later is replaced
by a TextBlock, so _colorText stays null; fix by removing the cached _colorText
and instead obtain the TextBlock from ColorButton.Content when needed (e.g.,
inside ApplyDarkTheme and ApplyLightTheme before calling SetValue) or change the
XAML to make the button content a named TextBlock (so you can reference it
directly); update ApplyConsoleTextColor, ApplyDarkTheme, and ApplyLightTheme to
read the live TextBlock from ColorButton.Content (or use the new named element)
before updating Foreground, and remove the _colorText field and its
InitTextBlocks assignment if you choose the on-demand approach.
- Around line 92-108: ApplyConsoleTextColor currently replaces
ColorButton.Content with a fresh TextBlock and sets Foreground on both Runs,
which discards theme styling; instead, modify the existing ColorButton.Content
TextBlock (or create one only if absent) and update only the dot Run's
Foreground to the palette brush while leaving the label Run without an explicit
Foreground so it inherits the button's themed Foreground; locate
ApplyConsoleTextColor, ColorButton.Content, the created
System.Windows.Documents.Run("● ") and Run($"Text Color: ...") and change the
logic to reuse/update the existing TextBlock.Inlines (or when creating new runs,
set Foreground only on the dot and omit Foreground on the label) so theme
changes still apply.

Comment thread Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml
Comment thread Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml.cs
Comment thread Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml.cs
Comment thread Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml.cs
Comment thread Ginger/Ginger/Drivers/DriversWindows/ConsoleDriverWindow.xaml.cs
@shahanemahesh
shahanemahesh merged commit e9d7304 into master Feb 17, 2026
20 of 26 checks passed
@shahanemahesh
shahanemahesh deleted the Feature/ColorSelectionOnConsoleDriver branch February 17, 2026 12:38
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.

3 participants