Sorry for a silly question but how can I make a random color hex generator in rescript ?
I’ve tried many methods but I’ve failed to get a good grasp of how rescript really work so far.
I could really need help with the task or at least a lead of how I can implement it correctly in rescript.
This is one of the examples of how I’ve failed (this is by far the closest that I got to get the module working):
let validHexCharacterArray = [“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “A”, “B”, “C”, “D”, “E”, “F”]
module ColorHex = {
let getRandomHexColorString = () => {
let hexColorString = "#";
for i in 0 to 6 {
let shuffleString = Js.String.concatMany(Belt.Array.shuffle(validHexCharacterArray))
hexColorString := hexColorString+ charAt(validHexCharacters, 0)
/* This has type: string
Somewhere wanted: ref<'a> */
}
hexColorString
}
}