-
Sun 2021.01.10
Hi @Guillaume_G chew on this for a while
The issue appears to be L26 with an incorrect parameter list.
Espruino reference forsetColor()
function:
This is a great web site to test Javascript concepts:Tutorial and Examples along with a 'TryIt' editor
This may also be solved using either Arrays or JSON object notation.https://www.w3schools.com/jsref/jsref_entries.asp
https://www.w3schools.com/jsref/jsref_obj_json.asp
If you wish to stay in base10 then these snippets might be one wayaryRGB =[ { "r": 255, "g": 0, "b": 0 }, { "r": 171, "g": 85, "b": 0 }, { "r": 171, "g": 171, "b": 0 }, { "r": 0, "g": 255, "b": 0 }, { "r": 0, "g": 171, "b": 85 }, { "r": 0, "g": 0, "b": 255 }, { "r": 85, "g": 0, "b": 171 }, { "r": 171, "g": 0, "b": 85 } ] var aryRGB = new Uint8ClampedArray( this.aryColors.length ); aryRGB = this.aryColors; var r = aryRGB[i].r; var g = aryRGB[i].g; var b = aryRGB[i].b;
or maybe in hexconst RGB = { AliceBlue : "F0F8FF", AntiqueWhite : "FAEBD7", Aqua : "00FFFF", Aquamarine : "7FFFD4", . . . // User defined functions required to extract each value this.decR = Color.cvrtHexToDec(this.colorR); var vals = {}; vals.r = this.decR; vals.g = this.decG; vals.b = this.decB;
and if you get stuck on the gristle, I'll check back in a few hours to get you over the goal post.
Hey!
I'm trying to stock the RGB color code in variables but I don't know how to use it in an argument like the argument of the g.setColor() function.
Here is my code
(this code doesn't work )
I don't know how to transfer the values of one variable in the arguments
I hope you see what I'm trying to do if not ask me ;)
Thanks for your help