How to Switch Rive Mascot & Logo Themes for Dark Mode with Data Binding
By the Charmotion team · Updated · How we write guides

To switch a Rive mascot or logo for dark mode, add a theme property to its Data Binding ViewModel in the Rive editor, bind the artwork's fill colors to it, and set that value from app code whenever the system or user theme changes. One .riv file then serves both themes, with no second export to ship.
Key takeaways
- Use one theme property or a few Color properties on a Data Binding ViewModel instead of separate dark-mode files.
- Bind each fill and stroke in the Rive editor, then write the values from app code.
- Read the ViewModelInstance only after the file has loaded, because setup timing differs by runtime.
- Check your runtime version's release notes before relying on data binding in production.
How to switch Rive animation themes for dark mode using Data Binding?
A Rive file can keep its colors in a ViewModel, which is a set of typed properties that the editor defines and app code reads and writes at runtime. For themes, that means the light and dark looks live in one .riv file. Your app changes a value, and the artwork redraws from the new values without loading a second file.
Rive View Model properties can be Number, String, Boolean, Color, Enum, Trigger, Image, nested View Model or List types. For a theme, two choices matter most: a Boolean (dark or not) and a set of Color properties, one per palette token. A Boolean is the simplest option for a mascot with a light and a dark look. Color tokens work better when the palettes differ in several places, because each token carries its own value.
| Approach | Best for | Trade-off |
|---|---|---|
| Boolean dark property | A simple light and dark pair | The editor must map the flag to two fixed looks |
| Color tokens (body, outline, accent) | Logos and mascots with several colored parts | App code sets every token for each theme |
| Separate .riv file per theme | Teams whose runtime does not support the binding they need | Two files to ship, load and keep in sync |
Most teams start with Color tokens. They keep the artwork in one file, and they let a designer change a palette without touching code. The file stays the single source for both themes, which is easier to review than two exports that drift apart.
How do you set up theme colors in the Rive editor?
Start with the file, not the code. Open the artboard for the mascot or logo in the Rive editor and create a ViewModel for it. Add the properties the theme needs, then bind the visible parts of the artwork to them.
A practical token set for a logo or mascot usually has three to five colors. Example values for a light and dark theme:
| Token (Color property) | Light theme (example) | Dark theme (example) |
|---|---|---|
| bodyFill | #FFFFFF | #1E2A38 |
| outline | #1E2A38 | #E6EEF7 |
| accent | #2F80ED | #6FB1FF |
| cheek | #FFB4A2 | #D9776A |
Next, bind each colored shape to its token. Select the fill or stroke of a shape and attach it to the matching Color property through the editor's data binding options for that field. Repeat for every part. Any shape you leave unbound keeps its authored color in both themes. That is the most common reason a mascot looks half switched, so check each layer in both states before you export.
If the dark version needs extra shapes, such as a moon for a sleeping character or a glow behind a logo, use a Boolean and a state machine that switches between the two looks. Keep the palette changes in Color tokens so the artwork and the code stay simple.
If you start from a Charmotion character, its file already contains CharacterViewModelMachine with a number property named mood and a boolean named accents. Add the theme property beside those in a copy of the file rather than replacing them.
How do you set the theme in the Rive web runtime?
The Web runtime gives app code two entry points into a file's data. The viewModelInstance getter returns the ViewModelInstance currently bound to the artboard. The viewModel(path) method returns a ViewModelInstance for a named ViewModel. You write values to the instance, and the artwork draws from those values.
A file with several artboards, such as a header logo and a footer logo, needs an instance for each bound artboard. The getBindableArtboard(name) method returns a BindableArtboard that exposes the data binding APIs, and setting its viewModel property binds an instance to that artboard. The setViewModelInstance call assigns an instance to the state machine without binding it, and bind() applies the instances that were set.
A minimal pattern for a light and dark switch that follows the device setting:
const scheme = window.matchMedia('(prefers-color-scheme: dark)');
function setTheme(isDark) {
// r is the loaded Rive instance. Its viewModelInstance getter returns
// the bound ViewModelInstance. Write the 'dark' Boolean, or the Color
// tokens, with the setter for each property type in the Web runtime docs.
const instance = r.viewModelInstance;
}
setTheme(scheme.matches);
scheme.addEventListener('change', (e) => setTheme(e.matches));
Call setTheme only after the file has loaded. Writing to an instance before the artboard is bound is the most common cause of a theme that never changes. If you want the full web setup for a framework, see how to use Rive data binding ViewModels in React and Next.js.
How do you set the theme in React Native, Flutter and Apple apps?
Each native runtime exposes the same idea, a ViewModelInstance you write to, with small differences in timing and naming. Check the runtime page for your platform before you copy any call.
- React Native: the useViewModelInstance hook creates an instance from a RiveFile, a ViewModel or a RiveViewRef. Its async option requires @rive-app/react-native 0.4.18 or later. Store the instance in state or a ref, and call your theme setter when the resolved scheme changes. The React Native runtime is native, so it needs a development build rather than Expo Go.
- Flutter: a ViewModel can create instances as blank, default, by index or by name, and each instance can be disposed when you no longer need it. From Flutter 0.15.0, data binding happens when a RiveWidgetController is created, and the separate dataBind call was removed. That release needs Flutter 3.32.0 (Dart 3.8.0) or later.
- Apple (SwiftUI and UIKit): from runtime v6.28.0, authored default ViewModel instances bind automatically. With the new initializers, Rive.viewModelInstance returns nil, so keep a reference to the instance you create. The older DataBind call is deprecated.
- Unity: runtime v0.4.5 added Global View Models. A single global theme value can serve several mascots on the same screen, so one switch updates each of them.
Whichever platform you use, the rule is the same: read the instance once the file is ready, write the theme values to it, and write again whenever the resolved theme changes. For a Unity interface, see Rive mascot in Unity UI.
How do you follow the device dark mode setting?
Resolve the theme in three steps: read the user's saved choice (system, light or dark), turn it into a Boolean, and write that Boolean to every instance on the screen. When the choice is system, listen for changes so the mascot follows the device without a reload.
- Store the choice in local storage or your user settings, with system as the default.
- Resolve system to matchMedia('(prefers-color-scheme: dark)').matches on the web, or to the platform's color scheme in a native app.
- Write the result to every instance the screen uses, including a global value where the runtime supports one.
- Run the same resolution again when the system scheme changes and when the user changes the setting.
Keep the page and the mascot on the same rule. If the page background follows the system setting but the mascot follows an in-app toggle, a user can see a light logo on a dark page. Read both from one source of truth.
Transparent artwork needs a contrast check on both backgrounds, because a token set that reads well on white can disappear on a dark page. The guide on transparent animated logos covers the background tests in more detail.
What goes wrong when you switch Rive themes at runtime?
Most problems fall into five groups. Check each one before you ship a dark mode.
- Reading the instance too early. Wait until the file has loaded before you write values. On Apple, with the new initializers, Rive.viewModelInstance can be nil, so hold the instance you created.
- Unbound shapes. A shape without a binding keeps its fixed color in both themes. Walk every artboard and bind each colored part.
- Runtime versions. Basic data binding appears from Web 2.26.6, Flutter 0.14.0, Apple 6.8.0, Android 10.1.0 and Unity 0.3.6, according to a third-party summary of Rive's docs. Confirm the version you ship against Rive's runtime release notes, and pin it in your lockfile.
- Videos are fixed frames. MP4, GIF and WebM exports do not respond to a runtime value. A dark version of a video is a separate export.
- Outdated code. Older tutorials still show the Apple DataBind call. It is deprecated, so use the initializers that the current runtime documents.
If you are deciding between data binding and state machine inputs for a mascot's mood, read Rive data binding vs state machine inputs. For a broader view of how the same mascot is set up across frameworks, see how to drive Rive character mood states from app state.
Switch a Rive mascot or logo theme for dark mode with Data Binding
- Create the ViewModel. In the Rive editor, add a ViewModel to the artboard with a Boolean dark property, or with one Color property for each palette token.
- Bind every colored part. Attach each fill and stroke that changes between themes to its matching property, so the palette is controlled by the file and not hard-coded.
- Export one .riv file. Export a single file that contains both themes, and confirm the ViewModel appears in the exported file before you ship it.
- Read the instance in app code. Use your platform's runtime call to get the ViewModelInstance after the file has loaded, and keep a reference to it.
- Write the theme values. Set the Boolean or Color values on that instance whenever the resolved theme changes.
- Follow the system setting. Resolve the user's choice to light or dark, listen for system changes, and apply the same rule to the page background so the mascot and page match.
Frequently asked questions
Can one .riv file hold both light and dark themes?
Yes. A single file can contain Color or Boolean properties on its ViewModel, and app code writes the values that the artwork uses. Both themes then ship in one asset. Rendered video is the exception, because each video is a fixed render and needs its own export per theme.
Does Rive document a built-in dark mode switch?
As of December 2026, Rive's data binding documentation describes typed properties that app code reads and writes, not a dedicated dark mode switch. A theme is therefore a property you define, such as a Boolean or a set of Color tokens, and your app decides when to change it.
Do I need one ViewModelInstance for each mascot on a page?
Each artboard you bind to a separate instance needs its own ViewModelInstance, so a page with several separately bound artboards needs one for each. Unity's Global View Models, added in runtime v0.4.5, can hold one shared theme value that several mascots read.
Can I export a dark version of an animated logo as video?
Yes. Export one MP4, GIF or WebM per theme from the matching state, because video files do not respond to runtime values. Transparent formats keep the background open, so test them on both light and dark pages before publishing.
Sources
- Rive Data Binding runtime parameters (Web), Rive
- Rive View Model property types, Rive
- Rive React Native runtime, Rive
- Rive Flutter runtime migration guide, Rive
- Rive runtime updates, October 1, 2026, Rive community
- Rive runtime updates, August 31, 2026, Rive community