Starting from Android Q (API level-29) Android offers a new Dark theme that applies to both the Android system UI and apps running on the device.
Questions tagged [android-dark-theme]
181 questions
137
votes
18 answers
How to implement Dark mode and Light Mode in flutter?
I want to create a flutter app that has 2 light and dark mode themes that change by a switch in-app and the default theme is default android theme.
I need to pass some custom color to the fellow widget and I don't want to just config material theme.…

javad bat
- 4,236
- 6
- 26
- 44
51
votes
7 answers
How to enable night mode programmatically?
I am looking for a way to enable night mode programmatically with an Android code:
public static void setNightMode(Context target, boolean state){
UiModeManager uiManager = (UiModeManager) target.getSystemService(Context.UI_MODE_SERVICE);
…

Ilan
- 729
- 3
- 8
- 17
26
votes
3 answers
Use a different image if Dark Mode is enabled on Android
I have two variants of a PNG, one where the drawn text is black and one where it is white. By default, on a white background, I am using the black image variant, but when the system dark mode is enabled the image becomes nearly invisible against the…

muad-dweeb
- 995
- 1
- 9
- 24
23
votes
2 answers
Android Jetpack Compose Preview UI_MODE_NIGHT_YES does not show dark background in preview
I am following https://developer.android.com/jetpack/compose/tutorial
and the code
@Preview(name = "Light Mode")
@Preview(name = "Dark Mode", uiMode = Configuration.UI_MODE_NIGHT_UNDEFINED, showBackground = true)
@Preview(name = "Full Preview",…

rofrol
- 14,438
- 7
- 79
- 77
22
votes
7 answers
Disable dark theme in Ionic
I'm designing an Ionic app, and I would like it to have white backgrounds and black texts whether the user has enabled the dark theme or not.
This is what I want:
However, when I enable the dark theme on an Android phone, it gets automatically…

Aldan Creo
- 686
- 1
- 5
- 14
21
votes
3 answers
How can I detect programmatically if the Android Device is in Dark Mode?
I'm trying to support the Android Q Dark theme for my Android app and I can't figure out how to import different assets based on the theme I'm currently in.
Im using the official DayNight theme for making the dark/light versions and for drawables is…

Izadi Egizabal
- 747
- 1
- 7
- 17
19
votes
4 answers
ContextCompat.getColor() ignore NightMode
TL,DR;
ContextCompat.getColor() does not use the night colors (values-night/colors.xml) though it should when night mode is enabled.
Here is the problem:
Hi everyone,
So I'm implementing a dark theme for my Android app, I call this to enable it :…

Mathieu de Brito
- 2,536
- 2
- 26
- 30
10
votes
3 answers
How do I force apply a dark theme on Android?
According to the docs, I only need to set android:forceDarkAllowed=true in my activity manifest and inherit theme from parent="Theme.MaterialComponents.DayNight". I tried that, but it didn't work.
Here's my manifest file:

Richard
- 7,037
- 2
- 23
- 76
9
votes
7 answers
Android - Dark mode issue: black text on dark background
When I enable the dark mode some menu on my app looking bad: black text on very dark background. I'm totally a beginner on color things.
I never touched anything on the default color settings on android studio yet, so I have the default two themes…

Andry
- 323
- 1
- 2
- 10
9
votes
1 answer
Is there any specific resource folder in android for dark mode drawables only?
When I turn on dark mode in my app, the icon of some dialogs is not visible because they are dark. I created those drawables with the "New Image Asset" option in the Android studio. is there any specific resource folder for dark mode drawables?

Amirhossein
- 179
- 4
- 18
9
votes
3 answers
Notification with inverted color with dark mode
On android 10, negative images i.e images with inverted color are displayed in the notification from custom-notification apps when dark mode is enabled.
How to prevent that from happening?
Notification with light theme:
Notification with Dark…

Nik
- 192
- 2
- 8
8
votes
2 answers
How to avoid forced dark theme in my app when devices can force it at app level?
Some devices, like Poco F2 Pro, can force dark theme in apps that are not compatible with dark theme.
For example, my app has this theme and is not compatible with dark theme: