0xff0000 would be easier to type then using string quotes IMO. I see
what your saying, when would I ever use the Color class? I guess I
wouldn't, but I would use need a way to represent colors in javascript
in general. Like when I need to set an elements background or color
CSS property. As well as a string, it would be nice to be able to pass
numbers to all CSS color properties. So I could write:
myElement.setStyles({
color: 0xff0000,
backgroundColor: 0xff0000
});
. I'm not saying that we should replace numbers with strings for color
values, but just add this to the framework. This way it's up to the
developer to decide which he/she prefers.
On Jan 5, 2:04 am, Michal <[email protected]> wrote:
> Interesting, but where do you think you would use this class? What
> would make it better than just the colour strings '#eeeeee' ?
>
> Michal.
>
> On Jan 5, 9:20 am, Sam <[email protected]> wrote:
>
> > I don't know it's appropriate to suggest things in this group but I'll
> > give it a shot.
>
> > About the Color class' first parameter, it could be either a string or
> > an array. It can be a string of a hex html value, "#ff0000" for
> > example. It can also be an array of the rgb or rgba values: [r, g, b,
> > a]. These are all good but might I suggest a number value as well?
> > Sense javascript has a hex based number syntax you could write
> > 0xff0000 and javascript will recognize this as 16711680. This would be
> > a great feature to the Color class.
>
> > What do you think?