Skip to content

Allow customizing AuthUITheme.topAppBarColors from outside AuthUITheme #2390

Description

@vegeta2102

Describe the feature request

I would like firebase-ui-auth to allow apps to customize the TopAppBar colors used by the built-in Compose auth screens.
At the moment, AuthUITheme.topAppBarColors is hardcoded internally and cannot be overridden from outside.
Current logic in AuthUITheme.kt:

  @get:Composable
  val topAppBarColors
      get() = TopAppBarDefaults.topAppBarColors(
          containerColor = MaterialTheme.colorScheme.primary,
          titleContentColor = MaterialTheme.colorScheme.onPrimary,
          navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
      )

Because of this, apps that integrate FirebaseUI Compose auth screens cannot align the app bar colors with their own theme system unless they replace the whole screen content themselves.

Suggested API options

Any of these would solve the problem:

Option 1: Add topAppBarColors to AuthUITheme

Example:

  data class AuthUITheme(
      val colorScheme: ColorScheme = ...,
      val typography: Typography = ...,
      val shapes: Shapes = ...,
      val topAppBarColors: TopAppBarColors? = null,
  )

And internally:

  val resolvedTopAppBarColors =
      authUITheme.topAppBarColors ?: TopAppBarDefaults.topAppBarColors(...)

Option 2: Add a topAppBarColors parameter to screen composables

Example:

  PhoneAuthScreen(
      ...,
      topAppBarColors = TopAppBarDefaults.topAppBarColors(...)
  )

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions