@killerwink/lottie-react-native-color
Version:
Change lottie react native .json file colors
54 lines (37 loc) • 1.4 kB
Markdown
Color changer for lottie react native
<strong>lottie-react-native-color</strong> is a utility that allows you change the color of a react native lottie file to any
This version will only allow one color to be changed across the .json file, This utility will <strong>not</strong> change the following -> <strong>transparency / white / black.</strong> This is by design and and further functionality to control this behaviour will be introduced.
<code>
npm i @killerwink/lottie-react-native-color
</code>
Import the utility into your file.
```javascript
import changeSVGColor from '@killerwink/lottie-react-native-color';
```
Invoke the function with 2 parameters
<ul>
<li><strong>SVG</strong> the path to the .json file</li>
<li><strong>color</strong>
</ul>
```javascript
changeSVGColor(require('./assets/lottie.json'), '#0081CF');
```
```javascript
import React from 'react';
import LottieView from "lottie-react-native";
import changeSVGColor from '@killerwink/lottie-react-native-color';
export const Animation = () => {
return (
<LottieView
ref={ani => {
this.ani = ani;
}}
source={changeSVGColor(require('./assets/lottie.json'), '#0081CF')}
/>
);
};
```