Skip to content

fix(ui): correct usage bar color logic#1411

Open
xbotter wants to merge 4 commits intoMoonshotAI:mainfrom
xbotter:fix-usage-color
Open

fix(ui): correct usage bar color logic#1411
xbotter wants to merge 4 commits intoMoonshotAI:mainfrom
xbotter:fix-usage-color

Conversation

@xbotter
Copy link

@xbotter xbotter commented Mar 12, 2026

Pass usage ratio (instead of remaining ratio) to _ratio_color. This fixes the inverted color display where high remaining showed red and low remaining showed green.

  • _format_row: calculate usage_ratio = used / limit
  • _ratio_color: usage >= 0.9 -> red, >= 0.7 -> yellow, else green

Fixes: 50% left showing green, 93% left showing red

Related Issue

Resolve N/A

Description

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

Copilot AI review requested due to automatic review settings March 12, 2026 02:48
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

This comment was marked as resolved.

Pass usage ratio (instead of remaining ratio) to _ratio_color.
This fixes the inverted color display where high remaining showed
red and low remaining showed green.

- _format_row: calculate usage_ratio = used / limit
- _ratio_color: usage >= 0.9 -> red, >= 0.7 -> yellow, else green

Fixes: 50% left showing green, 93% left showing red
xbotter added 3 commits March 12, 2026 11:01
- Verify _format_row passes usage ratio (used/limit) to _ratio_color
- Test boundary cases: 7%, 50%, 75%, 95% usage
- Test zero limit handling
Add boundary tests for 0%, 69%, 70%, 89%, 90%, 100% usage ratios
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.

2 participants