It’s a bit unclear whether setting the observable via hex works for you or not. You say it works, but then also ERROR? Ref:
Setting the Color via #hex value works var targetColor = Observable(“#FFF”) = ERROR
Anyway, I would expect that setting the hex values from javascript works, whereas trying to use “White” in javascript won’t work because it’s not defined anywhere in the JavaScript context.
It’s a bit unclear whether setting the observable via hex works for you or not. You say it works, but then also ERROR? Ref:
Setting the Color via #hex value works var targetColor = Observable(“#FFF”) = ERROR
Anyway, I would expect that setting the hex values from javascript works, whereas trying to use “White” in javascript won’t work because it’s not defined anywhere in the JavaScript context.
Hi Remi. First of all, my apologies for the confusion. I actually corrected my post.
So to confirm, setting the Color via #hex value works
var targetColor = Observable("#FFF");// This Works
Now, I understand what you mean about JS “White” not being defined anywhere in the JS Context, but I don’t think this is the case. I am merely passing the string “White” into the Color declaration.
var targetColor = Observable("White");// White=String not Variable
Not really. Without being an expert I’d say that it’s very likely that setting a property to a constant struct (which is what White is a helper-alias for here) behaves differently than binding it to an observable in JavaScript.
Either way, if you want to be able to use convenience-aliases (“text names”) for colors in javascript then you should define them there. (After all, defining them on your own also means you’ll know which RGB colors they actuall represent).
Not really. Without being an expert I’d say that it’s very likely that setting a property to a constant struct (which is what White is a helper-alias for here) behaves differently than binding it to an observable in JavaScript.
Either way, if you want to be able to use convenience-aliases (“text names”) for colors in javascript then you should define them there. (After all, defining them on your own also means you’ll know which RGB colors they actuall represent).
Ohh…OK. I guess I’m thinking of this in a very plain Variable=Value representation which I guess is wrong in the get go.
Anyway, it’s no biggie I don’t mind doing RGB, I was just trying to understand the situation.