Skip to content

feat(baseball): make bases, outs, and count display configurable#81

Merged
ChuckBuilds merged 1 commit intomainfrom
feature/baseball-configurable-bases-outs
Apr 1, 2026
Merged

feat(baseball): make bases, outs, and count display configurable#81
ChuckBuilds merged 1 commit intomainfrom
feature/baseball-configurable-bases-outs

Conversation

@ChuckBuilds
Copy link
Copy Markdown
Owner

@ChuckBuilds ChuckBuilds commented Apr 1, 2026

Summary

  • Add 12 user-configurable settings for live game bases diamond, outs circles, and balls-strikes count
  • Settings appear in the web UI under Customization with proper form controls (number inputs, color arrays)
  • Both switch mode (baseball.py) and scroll mode (game_renderer.py) respect the same config
  • Defaults match previous hardcoded values — existing displays unchanged

New settings (under customization)

Bases Diamond: diamond_size, occupied_color, empty_color, x_offset, y_offset
Outs Circles: circle_diameter, counted_color, empty_color, spacing, distance_from_bases
Count Text: text_color, y_offset

Test plan

  • Web UI renders all 12 new settings with proper form controls
  • Default config looks identical to current display
  • Custom colors render correctly on live game display
  • Adjusted sizes (larger bases, bigger outs) scale without overlap
  • x/y offsets shift the bases cluster as expected
  • NCAA games (no count data) still work correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Scoreboard display elements (bases, outs count, and balls-strikes text) now support customizable styling and layout options, including colors, sizing, spacing, and positioning adjustments via configuration.

Add user-configurable settings for the live game bases diamond, outs
circles, and balls-strikes count display. All settings appear in the
web UI under Customization with proper form controls.

New settings under customization:
- bases: diamond_size, occupied_color, empty_color, x/y_offset
- outs: circle_diameter, counted_color, empty_color, spacing,
  distance_from_bases
- count: text_color, y_offset

Both switch mode (baseball.py) and scroll mode (game_renderer.py)
read from the same config. Defaults match the previous hardcoded
values so existing displays are unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

The baseball-scoreboard plugin now supports configurable rendering for bases, outs, and count display. Geometric parameters (sizing, spacing, offsets) and colors previously hardcoded in Python files are now read from a customization section in the config schema with sensible defaults, applied during scorebug rendering.

Changes

Cohort / File(s) Summary
Configuration Schema
plugins/baseball-scoreboard/config_schema.json
Added three new optional objects under customization: bases (diamond sizing, colors, positioning offsets), outs (circle sizing, colors, spacing), and count (text color, vertical offset). Each includes properties with defaults and constraints; updated x-propertyOrder accordingly.
Rendering Implementation
plugins/baseball-scoreboard/baseball.py, plugins/baseball-scoreboard/game_renderer.py
Updated scorebug rendering logic to read bases, outs, and count customization from config instead of using hardcoded constants. Applied configurable geometry (sizes, spacing, offsets), colors (occupied/empty bases, counted/empty outs, text), and positioning throughout rendering calls.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(baseball): make bases, outs, and count display configurable' accurately summarizes the main change: introducing configurability for baseball scoreboard display elements through new config schema and rendering updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/baseball-configurable-bases-outs

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

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

Caution

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

⚠️ Outside diff range comments (1)
plugins/baseball-scoreboard/game_renderer.py (1)

297-318: ⚠️ Potential issue | 🟠 Major

Occupied bases incorrectly inherit empty-base outline color in scroll mode.

When occupied_color and empty_color differ, occupied bases are still drawn with outline=base_outline, which makes scroll mode visually inconsistent with switch mode.

Proposed fix
-            draw.polygon(poly2, fill=base_fill if bases_occupied[1] else None, outline=base_outline)
+            if bases_occupied[1]:
+                draw.polygon(poly2, fill=base_fill)
+            else:
+                draw.polygon(poly2, outline=base_outline)

@@
-            draw.polygon(poly3, fill=base_fill if bases_occupied[2] else None, outline=base_outline)
+            if bases_occupied[2]:
+                draw.polygon(poly3, fill=base_fill)
+            else:
+                draw.polygon(poly3, outline=base_outline)

@@
-            draw.polygon(poly1, fill=base_fill if bases_occupied[0] else None, outline=base_outline)
+            if bases_occupied[0]:
+                draw.polygon(poly1, fill=base_fill)
+            else:
+                draw.polygon(poly1, outline=base_outline)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/baseball-scoreboard/game_renderer.py` around lines 297 - 318, The
occupied bases use base_outline regardless of occupancy; update the draw.polygon
calls for poly2, poly3, and poly1 so the outline parameter is conditional: use
base_outline when the base is empty, otherwise use base_fill (i.e.,
outline=base_fill if bases_occupied[index] else base_outline) so occupied bases
get the occupied color as their outline instead of inheriting the empty-base
outline.
🧹 Nitpick comments (1)
plugins/baseball-scoreboard/game_renderer.py (1)

266-344: Consider centralizing base/out/count rendering config normalization.

This block duplicates defaulting and geometry setup also implemented in plugins/baseball-scoreboard/baseball.py, which increases drift risk between switch and scroll modes.

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

In `@plugins/baseball-scoreboard/game_renderer.py` around lines 266 - 344, The
rendering code duplicates config defaulting and geometry math from baseball.py;
extract a shared normalization helper (e.g., normalize_display_config or
normalize_base_layout) that accepts self.config, inning_bbox, inning_half and
game and returns normalized bases_cfg, outs_cfg, count_cfg, base_diamond_size,
out_circle_diameter, out_vertical_spacing, spacing_between_bases_outs,
base_cluster_width, base_cluster_height, bases_origin_x, overall_start_y,
out_cluster_height and has_count_data; update the GameRenderer method (the
method using self.config, bases_cfg, outs_cfg, count_cfg, bases_origin_x,
overall_start_y, base_cluster_* and has_count_data) to call that helper and use
its returned values instead of repeating default logic, and make baseball.py
call the same helper so both switch and scroll modes share a single source of
truth while leaving drawing calls (_draw_text_with_outline,
draw.polygon/ellipse) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@plugins/baseball-scoreboard/game_renderer.py`:
- Around line 297-318: The occupied bases use base_outline regardless of
occupancy; update the draw.polygon calls for poly2, poly3, and poly1 so the
outline parameter is conditional: use base_outline when the base is empty,
otherwise use base_fill (i.e., outline=base_fill if bases_occupied[index] else
base_outline) so occupied bases get the occupied color as their outline instead
of inheriting the empty-base outline.

---

Nitpick comments:
In `@plugins/baseball-scoreboard/game_renderer.py`:
- Around line 266-344: The rendering code duplicates config defaulting and
geometry math from baseball.py; extract a shared normalization helper (e.g.,
normalize_display_config or normalize_base_layout) that accepts self.config,
inning_bbox, inning_half and game and returns normalized bases_cfg, outs_cfg,
count_cfg, base_diamond_size, out_circle_diameter, out_vertical_spacing,
spacing_between_bases_outs, base_cluster_width, base_cluster_height,
bases_origin_x, overall_start_y, out_cluster_height and has_count_data; update
the GameRenderer method (the method using self.config, bases_cfg, outs_cfg,
count_cfg, bases_origin_x, overall_start_y, base_cluster_* and has_count_data)
to call that helper and use its returned values instead of repeating default
logic, and make baseball.py call the same helper so both switch and scroll modes
share a single source of truth while leaving drawing calls
(_draw_text_with_outline, draw.polygon/ellipse) unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 65376cf8-646c-4a83-9630-9736c26f26d3

📥 Commits

Reviewing files that changed from the base of the PR and between 9d3ad6a and cf4a82f.

📒 Files selected for processing (3)
  • plugins/baseball-scoreboard/baseball.py
  • plugins/baseball-scoreboard/config_schema.json
  • plugins/baseball-scoreboard/game_renderer.py

@ChuckBuilds ChuckBuilds merged commit c4b2b88 into main Apr 1, 2026
1 check passed
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