DayNightStyle

class DayNightStyle
androidx.car.widget.DayNightStyle

Specifies how the system UI should respond to day/night mode events.

By default, the Android Auto system UI assumes the app content background is light during the day and dark during the night. The system UI updates the foreground color (such as status bar icon colors) to be dark during day mode and light during night mode. By setting the DayNightStyle, the app can specify how the system should respond to a day/night mode event. For example, if the app has a dark content background for both day and night time, the app can tell the system to use #FORCE_NIGHT style so the foreground color is locked to light color for both cases.

Note: Not all system UI elements can be customized with a DayNightStyle.

Summary

Constants
static Int

Sets the foreground color to be automatically changed based on day/night mode, assuming the app content background is light during the day and dark during the night.

static Int

Sets the foreground color to be automatically changed based on day/night mode, assuming the app content background is dark during the day and light during the night.

static Int

Sets the foreground color to be locked to the day version, which assumes the app content background is always light during both day and night.

static Int

Sets the foreground color to be locked to the night version, which assumes the app content background is always dark during both day and night.

Public constructors

Specifies how the system UI should respond to day/night mode events.

Constants

AUTO

static val AUTO: Int

Sets the foreground color to be automatically changed based on day/night mode, assuming the app content background is light during the day and dark during the night.

This is the default behavior.

Value: 0

AUTO_INVERSE

static val AUTO_INVERSE: Int

Sets the foreground color to be automatically changed based on day/night mode, assuming the app content background is dark during the day and light during the night.

Value: 1

FORCE_DAY

static val FORCE_DAY: Int

Sets the foreground color to be locked to the day version, which assumes the app content background is always light during both day and night.

Value: 3

FORCE_NIGHT

static val FORCE_NIGHT: Int

Sets the foreground color to be locked to the night version, which assumes the app content background is always dark during both day and night.

Value: 2

Public constructors

<init>

DayNightStyle()

Specifies how the system UI should respond to day/night mode events.

By default, the Android Auto system UI assumes the app content background is light during the day and dark during the night. The system UI updates the foreground color (such as status bar icon colors) to be dark during day mode and light during night mode. By setting the DayNightStyle, the app can specify how the system should respond to a day/night mode event. For example, if the app has a dark content background for both day and night time, the app can tell the system to use #FORCE_NIGHT style so the foreground color is locked to light color for both cases.

Note: Not all system UI elements can be customized with a DayNightStyle.