fix(cli): resolve autoThemeSwitching when background hasn't changed but theme mismatches#20706
fix(cli): resolve autoThemeSwitching when background hasn't changed but theme mismatches#20706
Conversation
…ut theme mismatches
Summary of ChangesHello, 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 addresses a bug in the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly resolves an issue where automatic theme switching would fail if the terminal background color hadn't changed, but the theme was mismatched. The fix is well-implemented and is accompanied by a new unit test that specifically validates this edge case. The suggested refactoring for improved conciseness and maintainability has been retained as it aligns with general best practices.
|
Size Change: +95 B (0%) Total Size: 25.8 MB ℹ️ View Unchanged
|
…ut theme mismatches (google-gemini#20706)
…ut theme mismatches (google-gemini#20706)
Summary
Fixes an issue where
autoThemeSwitchingwould not work if the terminal background color hadn't changed since the application started, but the active theme was mismatched (e.g. a Light theme on a Dark background).The bug was caused by an early return inside
handleTerminalBackgroundthat bypassed the theme-switching logic whenpreviousColor === hexColor.Details
Moved the logic for evaluating the theme (
getLuminance,shouldSwitchTheme) to happen before the early return check, so the theme matching logic still runs and correctly applies the theme even when the background hasn't changed.Included a new unit test in
useTerminalTheme.test.tsxto explicitly verify this edge-case behavior.Related Issues
Fixes #20705
How to Validate
ui.themeset todefault-light(andautoThemeSwitchingenabled).terminalBackgroundPollingInterval(default 60s).Pre-Merge Checklist