In res/values/colors
There are two colors
colors.xml
colors.xml(night)
If night does not exist, you can make it as follows:
Right click on the values folder.
Next New. Then Values Resource file
Enter the colors in the file name field
And enter the values-night in the directory name field.
In colors.xml, select the colors that are for the light, such as:
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryVariant">#303F9F</color>
<color name="colorButton">#303F9F</color>
In colors.xml(night), set the colors for the night(Same name as colors):
<color name="colorPrimary">#212121</color>
<color name="colorPrimaryVariant">#000000</color>
<color name="colorButton">#10ffffff</color>
Now if in layout, for example:
<Button
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: background = "@color/colorButton" />
It is selected according to what you put in the light and night colors.