[Share] bootsplash in dark mode
See original GitHub issueThis is not a issue, only share to help anybody, if you want create bootsplash based on device theme.
Android:
- create two files bootsplash.xml as in README.md but change background color
- bootsplash_dark.xml
- bootsplash_light.xml
example: bootsplash_dark.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<!-- here change color, dark: @android:color/background_dark or @android:color/background_light -->
<item android:drawable="@android:color/background_dark" />
<item>
<!-- the app logo, centered horizontally and vertically -->
<bitmap
android:src="@mipmap/bootsplash_logo"
android:gravity="center" />
</item>
</layer-list>
- create this files in android/app/src/main/res/values/styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
<!-- Add the following lines -->
<!-- BootTheme should inherit from AppTheme -->
<style name="BootTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- set bootsplash.xml as activity background -->
<item name="android:background">@drawable/bootsplash_light</item>
</style>
</resources>
- Create this file in android/app/src/main/res/values-night/styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
<!-- Add the following lines -->
<!-- BootTheme should inherit from AppTheme -->
<style name="BootTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- set bootsplash.xml as activity background -->
<item name="android:background">@drawable/bootsplash_dark</item>
</style>
</resources>
and MainActivity.java:
....
import android.content.res.Configuration; // check if these already import
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int drawableId = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
? R.drawable.bootsplash_dark
: R.drawable.bootsplash_light; //Default light theme
RNBootSplash.init(drawableId, MainActivity.this);
}
iOS:
Setting System default color in BootSplash.storyboard > View
Thank you to this tutorial
Issue Analytics
- State:
- Created 4 years ago
- Reactions:19
- Comments:7 (2 by maintainers)
Top Results From Across the Web
android Core Splashscreen API makes launcher icon black in ...
They have fixed the dark mode issue. But the images and colors still appear a little darker than what we set in themes....
Read more >React native bootsplash cli fork
Fork allows generating dark mode splash screens. Fork is based on original react-native-bootsplash CLI with following changes:.
Read more >Chrome OS needs a dark theme for its boot screen so my poor ...
Dark theme is appearing all across the OS and is even a part of the Recovery Screen now. ... boot-splash: allow customization of...
Read more >is there a way to customize boot splash? : r/GalliumOS - Reddit
I think you can get themes to put in /usr/share/plymouth/ but I have never done it and I ... r/chromeos - Dark mode...
Read more >How to add a dark mode splash screen to a React Native app?
Dark mode is everywhere after the new iOS 13 update. A lot of developers have started adjusting apps to support a dark theme...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@punisher97 This is great, thanks!
@zoontek Maybe we should add a link to this in the README as dark mode is quite widely implemented nowadays? 🙂
@mixmaker
See this blog post that was linked at the beginning for more information.