question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Share] bootsplash in dark mode

See original GitHub issue

This is not a issue, only share to help anybody, if you want create bootsplash based on device theme.

Android:

  1. 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>
  1. 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>
  1. 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

image

Thank you to this tutorial

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:19
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
alexandersandbergcommented, Nov 26, 2020

@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? 🙂

1reaction
alexandersandbergcommented, May 24, 2022

@mixmaker

I had a confusion. Where should I create bootsplash_light.xml and bootsplash_dark.xml, I mean the exact directory?

See this blog post that was linked at the beginning for more information.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found