Showing posts with label SVN. Show all posts
Showing posts with label SVN. Show all posts

Saturday, January 19, 2008

Next! - Color

Hi again.

some time ago i have done a class to deal with colors, since i think about create some kind of GFX support ( SVG,VML) , i decided to put it here

Its just 8,00 KB Minified, so its not that much, and much of the sise is because of the default colors, that can be removed.
Eg. it have Next.Color.Red="##FF0000" etc...;

You can access the source of the class here http://nextjs.googlecode.com/svn/trunk/lib/Color.js.
If you have a SVN copy on your pc just do an update to it.

The class is named Next.Color

This class give many ways to convert color formats

* Usage:
* new Next.Color(r,g,b);//parameters
* new Next.Color([r,g,b]);//array with 3 numbers
* new Next.Color({R:r,G:g,B:b});//object with R,G,b or r,g,b members
* new Next.Color("RGB(r,g,b)");//String RGB CSS
* new Next.Color("#FFFFFF");//String HEX CSS

You can export to:
Array
Object
RGB
HEX

It have a helper function very cool when we need to check and use some color, lets say:

function dc(c){
if ((c=Next.Color.check(c))!==null){
alert(c);//toString method on Color class give you the hex value
}
}

dc("Red");//alert's "##FF0000"
dc("RGB(255,0,0)")
;//alert's "#FF0000"
dc("#FF0000");//alert's "#FF0000"
dc([255,0,0]);//alert's "#FF0000"
dc({r:255,g:0,b:0})
;//alert's "#FF0000"
dc({R:255,G:0,B:0});//alert's "#FF0000"
Its nothing special but still useful for the upcoming GFX stuff

Its all for now!!


Wednesday, January 16, 2008

Hi again!

I am here to announce that i hosted the code of this project on googlecode

http://code.google.com/p/nextjs/

I committed the current code into SVN repository, you can checkout and play around with it.

Its not much yet, and theres some stuff there that i haven't talked here about yet ( but i will soon )

The code is a bit mess, i am reorganizing it, then i will commit changes

Enjoy!