File size: 469 Bytes
8fd7a1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* eslint-disable import/no-commonjs */

const OLD_PRIMARY_COLOR = '#855cd6';

const loader = source => `
    const original = ${JSON.stringify(source)};

    const getSRC = () => {
        const recolored = typeof Recolor === 'object' ? (
            original.replace(/${OLD_PRIMARY_COLOR}/gi, Recolor.primary)
        ) : original;
        return 'data:image/svg+xml;,' + encodeURIComponent(recolored);
    };

    export default getSRC;
`;

module.exports = loader;