Skip to content

fix(auth): allow customizing top app bar colors via AuthUITheme#2391

Open
demolaf wants to merge 5 commits into
version-10.0.0-beta04from
fix/customizable-top-app-bar-colors
Open

fix(auth): allow customizing top app bar colors via AuthUITheme#2391
demolaf wants to merge 5 commits into
version-10.0.0-beta04from
fix/customizable-top-app-bar-colors

Conversation

@demolaf

@demolaf demolaf commented Jul 15, 2026

Copy link
Copy Markdown
Member

Fixes #2390.

AuthUITheme.topAppBarColors was a companion-object getter derived from the ambient MaterialTheme.colorScheme, so there was no way to override it per AuthUITheme instance — apps couldn't align the auth screens' top app bar with their own branding.

Usage

val customTheme = AuthUITheme.Default.copy(
    topAppBarColors = TopAppBarColors(
        containerColor = Color(0xFFFFA000), // firebase primary color - amber
        scrolledContainerColor = Color(0xFFFFA000),
        navigationIconContentColor = Color.White,
        titleContentColor = Color.White,
        actionIconContentColor = Color.White,
        subtitleContentColor = Color.White,
    )
)

val configuration = authUIConfiguration {
    context = applicationContext
    theme = customTheme
    // ...
}

Preview

Screenshot_1784126283

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the ability to customize top app bar colors on authentication screens by adding a topAppBarColors property to AuthUITheme and applying it across various UI screens. The review feedback highlights a compilation error in HighLevelApiDemoActivity.kt due to the use of a non-existent subtitleContentColor parameter in Material 3's TopAppBarColors. Additionally, because TopAppBarColors is an experimental API, the reviewer recommends adding the @OptIn(ExperimentalMaterial3Api::class) annotation locally in the demo activity and propagating the @property:ExperimentalMaterial3Api annotation to the public property in AuthUITheme.

Comment thread app/src/main/java/com/firebaseui/android/demo/HighLevelApiDemoActivity.kt Outdated

@russellwheatley russellwheatley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few bits of feedback

SelectFactorUI's TopAppBar in MfaEnrollmentDefaults.kt doesn't take colors at all, so it won't pick up topAppBarColors (or even the existing default). Can you wire that one up too, otherwise the 2FA screen won't match once someone sets a custom color.

see auth/src/main/java/com/firebase/ui/auth/ui/screens/MfaEnrollmentDefaults.kt:255 (the TopAppBar call inside SelectFactorUI)

* Custom colors for the top app bar shown on auth screens. If null, falls back to
* colors derived from [colorScheme] (see [AuthUITheme.topAppBarColors]).
*/
val topAppBarColors: TopAppBarColors? = null,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LocalAuthUITheme.current.topAppBarColors ?: AuthUITheme.topAppBarColors is copied into all 6 screen files - can we pull that into one resolved property on AuthUITheme instead? Saves updating 6 files next time this logic changes.


@OptIn(ExperimentalMaterial3Api::class)
@Test
fun `Copy with custom topAppBarColors applies correctly`() {

@russellwheatley russellwheatley Jul 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The new tests just re-check the theme object, not the actual screens - since the fallback's duplicated everywhere, this won't catch a screen missing it. Worth testing off the shared helper once it's extracted (see point 1)

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