- 
                Notifications
    You must be signed in to change notification settings 
- Fork 48
Improve tab bar color contrast in light and dark modes #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update tab bar unselected item color from 40% to 60% opacity for better contrast and visibility in both light and dark modes. Changes: - Light mode: selected uses dark color, unselected uses 60% opacity dark (was 40%) - Dark mode: selected uses white, unselected uses 60% opacity white (was 40%) The subtle difference (100% vs 60%) provides better visual feedback while maintaining a clean, modern look consistent with iOS design patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the visual accessibility of the tab bar by increasing the opacity of unselected tab items from 40% to 60% for better contrast in both light and dark modes. The change maintains the clean iOS aesthetic while making unselected tabs more visible to users.
Key Changes:
- Added initialization code to configure UITabBar appearance
- Increased unselected item opacity from 40% to 60% for better visibility
- Implemented dynamic color adaptation for light and dark interface styles
        
          
                V2er/View/MainPage.swift
              
                Outdated
          
        
      | // Set tint color for selected items | ||
| // Light Mode: deep/dark color (from Color.tintColor) | ||
| // Dark Mode: white (from Color.tintColor) | 
    
      
    
      Copilot
AI
    
    
    
      Oct 18, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider documenting what Color.tintColor represents or referencing it in the comment. The current comment mentions 'deep/dark color' and 'white' but doesn't clarify that this comes from the app's tint color configuration.
| // Set tint color for selected items | |
| // Light Mode: deep/dark color (from Color.tintColor) | |
| // Dark Mode: white (from Color.tintColor) | |
| // Set tint color for selected tab bar items. | |
| // The color is taken from the app's tint color configuration (Color.tintColor). | |
| // In Light Mode, this is typically a deep/dark color; in Dark Mode, it is typically white. | 
| let unselectedColor = UIColor { traitCollection in | ||
| switch traitCollection.userInterfaceStyle { | ||
| case .dark: | ||
| // Dark mode: slightly dimmed white (60% opacity for subtle difference) | ||
| return UIColor.white.withAlphaComponent(0.6) | ||
| default: | ||
| // Light mode: slightly lighter dark color (60% opacity for subtle difference) | ||
| return UIColor.black.withAlphaComponent(0.6) | ||
| } | ||
| } | 
    
      
    
      Copilot
AI
    
    
    
      Oct 18, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the opacity value (0.6) as a named constant to make it easier to adjust and maintain consistency. For example: private static let unselectedTabOpacity: CGFloat = 0.6
| Code Coverage Report ❌Current coverage: 0% | 
Fix tab bar colors by using proper SwiftUI approach instead of UIKit appearance APIs: - Use .tint(Color.primary) for selected items (auto-adapts to light/dark mode) - Set appearance.stackedLayoutAppearance for unselected text colors - Remove UITabBar.appearance().tintColor to fix dark mode color reversal Light mode: selected=black, unselected=light gray (78%) Dark mode: selected=white, unselected=dim gray (60%) Text colors now work correctly, icon colors need further fix. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Simplify the tab bar color implementation: - Use UITabBar.appearance().unselectedItemTintColor for unselected items (both icons and text) - Use .accentColor(Color.primary) modifier on TabView for selected items - Remove complex UITabBarAppearance layout configurations This simpler approach should properly apply colors to both icons and text: - Light mode: selected=black, unselected=light gray (78%) - Dark mode: selected=white, unselected=dim gray (60%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| Code Coverage Report ❌Current coverage: 0% | 
Summary
Improve tab bar icon contrast by adjusting the unselected item opacity from 40% to 60% for better visibility in both light and dark modes.
Changes
Color Adjustments
Light Mode:
Dark Mode:
Benefits
Technical Details
UITabBar.appearance().unselectedItemTintColorin MainPage initstandardAppearanceandscrollEdgeAppearanceTesting
Before vs After
Before: 40% opacity made unselected tabs too faint, hard to see at a glance
After: 60% opacity provides clear visual feedback while maintaining elegance
🤖 Generated with Claude Code