← Back to Pull requests

Add day and night colors, and default to a Material 3 DayNight theme #137

Merged
kattni merged 4 files (20 lines) on Dec 02, 2026 08:01 UTC
View on GitHub
kattni kattni commented on Nov 30, 2026 03:28 UTC
Author

Toga's Android backend is moving to Material 3, and Briefcase's Toga bootstrap is moving to a Theme.Material3.DayNight theme. In dark mode, that theme expects a light primary color, and uses dark text (#381E72) on buttons filled with it. This template always sets colorPrimary to the app's primary_color (#008577 by default), so in dark mode those buttons get dark text on a dark fill.

This PR:

  • Lets primary_color, primary_color_dark and accent_color be either a single color, used in both light and dark mode, or a table with day and night values, such as primary_color = {day = "#5B2A8C", night = "#D4BBFF"}. Night values are written to a new values-night/colors.xml. A table needs both keys. If one is missing, briefcase create fails with a configuration error.

  • Adds primary_text_color, which sets colorOnPrimary and takes the same forms. It defaults to #FFFFFF, so these buttons are readable in dark mode with no configuration.

  • Changes the default base_theme from Theme.AppCompat.Light.DarkActionBar to Theme.Material3.DayNight.

  • Always adds com.google.android.material:material:1.13.0, next to the AppCompat dependency the template already adds. colorOnPrimary is defined by the Material library, so including it keeps every app building, whatever its theme.
  • Effect on existing apps, checked on an Android 15 emulator in light and dark mode:

  • An app that sets base_theme and uses single colors looks the same. An app with Theme.AppCompat.Light.DarkActionBar and released Toga 0.5 was pixel-identical with the old and new template, in both modes.

  • An app that doesn't set base_theme gets Theme.Material3.DayNight at its next briefcase create. With Toga 0.5 it stays readable in both modes, but it looks different: the app bar no longer uses the primary color, and the app follows dark mode.
  • Generating a full Material 3 color scheme from a seed color is a possible later alternative, tracked in beeware/briefcase#3167.

    Note: Briefcase change

    beeware/briefcase#3168 documents these settings and updates the Toga bootstrap. Because this template now provides the theme and the Material library, the bootstrap no longer sets base_theme or lists the Material dependency. beeware/briefcase#3168 must merge together with or after this PR. Otherwise, new Toga apps would get an AppCompat theme without the Material library.

    PR Checklist:


    <!--- Go over all the following points, and put an x in all the boxes that apply. -->
  • I will abide by the BeeWare Code of Conduct

  • I have read and have followed the [CONTRIBUTING.md](../blob/main/CONTRIBUTING.md) file

  • This PR was generated or assisted using an AI tool

  • <!-- update or delete the next line to reflect your usage -->
    Assisted-by: Claude Code (Claude Opus 5.5)

    Diff: 20 lines (+17 / -3) across 4 files Reviewer: freakboy3742 Review duration: 3153m
    All Vouch review confidence checks passed
    Residual risk 0.10 = Change Risk (0.31) × (1 − Review Confidence (0.68)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 20 lines diff across 4 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.35 · 1 substantive comment(s)
    0.35
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    67%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.182
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    3 items
    freakboy3742 freakboy3742 commented on Nov 30, 2026 06:44 UTC
    Reviewer

    These changes all make sense; the only questions relate to bigger picture issues raised on the matching Briefcase PR:
    1. Whether the surface color should be customizable
    2. Whether material should be promoted to this template

    freakboy3742 freakboy3742 approved these changes on Dec 02, 2026 07:57 UTC
    Approved Reviewer

    Following the discussion on the Briefcase ticket, I've reverted some of the proposed changes in favour of explicit configuration on the Briefcase side; otherwise, this looks great - thanks!

    Reviewers
    Assignees
    kattni kattni
    Labels
    risk: low confidence: 67.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 30.6% (LOW) · Higher = larger blast radius
    30.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 67.5% · Lower = rushed or shallow review
    67.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 9.9% · Safe to merge
    9.9%