I have a file let's say Colors.js which contains some hex values as follows:
module.exports = {
red50: '#ffebee',
red100: '#ffcdd2',
red200: '#ef9a9a',
red300: '#e57373',
red400: '#ef5350',
red500: '#f44336',
red600: '#e53935',
red700: '#d32f2f',
red800: '#c62828',
red900: '#b71c1c'
};
What I'm trying in another file is is to randomly take the above-defined objects and assign them as inline-css backgroundColor after importing Colors.js file
So eventually instead of defining one of them manually as follows:
import Colors from "../Colors";
module.exports = function() {
return {
someStyle: {
background: Colors.red500
},
};
};
I can return a random Color object
import Colors from "../UI/Colors";
module.exports = function() {
return {
someStyle: {
background: `Randomly picked object from Color.js file`
},
};
};
I'm pretty much clueless on how to achieve this.