nandorojo / burnt

Crunchy toasts for React Native. 🍞
MIT License
1.16k stars 36 forks source link

Feature request: support for setting "color scheme" #44

Open gorbypark opened 1 month ago

gorbypark commented 1 month ago

My app has the ability for the user to pick dark mode, light mode or system. It would be great if I could force the color mode of the toast so that when, for example, the user's phone is in dark mode but they have selected light mode in the app, then the toast could be shown in light mode, not what the users phone color scheme is set to.

I realize this might not be possible based on the libraries used, but just thought I'd throw it out there.

Thanks for the great library!

mvolonnino commented 1 month ago

Hey @gorbypark - you can do that without any changes needed to this library. You'll want to use Appearance from react-native

would look something like this:

// whatever code you have to set light, dark, system

// example:
// simplified

Appearance.setColorScheme(appColorMode !== 'system' ? appColorMode : null)

So if your appColorMode is not system, you can directly set either light or dark, null will reset it back to use the system color scheme 👍

nandorojo commented 1 month ago

If you’re using expo all you need to do is install their system ui library and set the appearance in your app config