How can i block force dark theme?

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
   <item name="android:forceDarkAllowed">false</item>

can i add this code to my app ?

Try it and see what happens…

i don’t know , how to use this one! please help me

Unfortunately, I haven’t researched this and therefore I can’t give you any wise advice…

1 Like

can i change this one to an extention?

Extension creates with java langvage and

This does not looks like java

are there any other ways to prevent force dark theme?

i just copied from there

Does the layout Colors changes in this APK ( when force dark mode is Enabled) ?
PreventDarkMode (20).apk (5.2 MB)
This is the original one, its layout Colors changes:
PreventDarkMode (19).apk (5.2 MB)
P.S: I don’t have a device with Android 10 or heigher, but I have tested this on Android studio emulater :grimacing:

I have Android 10 but it Doesn’t Change

One Ui 2.0

1 Like

yes, is changing

Do you mean that the colours changed in this one to dark when enabling the force dark mode?

yes, i want to remove it

This is how the first APK should look( in the case if force dark mode ):-

And this is how the second one should look ( in the case if force dark mode ):-

Does the same happens for you?
Actually I created an extension to disable Force Dark Mode, so , is your app is affected by force dark mode, when placing it in screen1 :thinking:
io.mohamed.DisableDarkMode.aix (5.0 KB)

1 Like

Thank you I also need this extension

You just have to add it to Screen1 and it should prevent changing the colors of your app in the force dark theme mode on the whole app. You don’t have yo use any blocks.

This is me Vinay, same person from different account.

This extension does not work on my end, could you please provide me with an .aia file.

Hello :wave:,

You should Only have one account in kodular community :slightly_smiling_face:

How are you using, can you send your AIA?
And here us the AIA for the test APK above:
PreventDarkMode.aia (11.4 KB)
It works fine at my end ( see the screenshots above ).