Page 1 of 2

Break my code

Posted: Tue Jul 02, 2002 5:47 pm
by protokol
Ok, I have this thing working great, so now I need people to try and break my code. Give it your best shot. I have a good feeling that it's break-proof :lol:

http://easypim.sourceforge.net/color/

Posted: Tue Jul 02, 2002 5:53 pm
by hob_goblin
did you know hex codes could be 3 chars too?

Posted: Tue Jul 02, 2002 5:55 pm
by protokol
no, actually, i did not realize hex color codes could be 3 chars long .. explain

Posted: Tue Jul 02, 2002 5:58 pm
by hob_goblin
im pretty sure #000 would turn out black. #FFF white, #00F blue... etc..

Posted: Tue Jul 02, 2002 6:07 pm
by protokol
Well, although some browsers may recognize those codes as being valid, it is definitely not standard.

According to http://www.w3schools.com/html/html_colorsfull.asp Hex color codes are 6-chars long.

Each Red, Green, and Blue is represented by a 2-char hex.

So with this RGB: 10 11 12 , the represented numbers in hex would be 0A 0B 0C which means #0A0B0C .. if the hex is only 1 char long, then it has to have a 0 followed by the character. This also applies to RGB: 0 1 2, which is #000102

Posted: Wed Jul 03, 2002 9:09 am
by RandomEngy
Just a note, clicking on the web-safe colors for me pops up a window that I have to resize in order to see all of the colors.

Posted: Wed Jul 03, 2002 9:59 am
by protokol
RandomEngy wrote:Just a note, clicking on the web-safe colors for me pops up a window that I have to resize in order to see all of the colors.
The way that the colorchart.php script works (web-safe color popup) is it dynamically generates an HTML table with the <td bgcolor=""> == to the corresponding web-safe color. I have tested the popup on many different browsers/platforms, and there is really no way for me to make the popup window the correct size.

Some browsers the window is sized perfectly, some browsers the window is too big, and in your case it is too small. Until I can figure out a better way to display the colors, this will have to be the way that is works.

Posted: Wed Jul 03, 2002 10:10 am
by RandomEngy
Well, if the table is the same all of the time, just make it a static table with no cellpadding and cellspacing, and each cell a set width and height. That should make the table size exactly x-pixels high and y-pixels wide.

Shouldn't it?

Posted: Wed Jul 03, 2002 10:15 am
by protokol
RandomEngy wrote:Well, if the table is the same all of the time, just make it a static table with no cellpadding and cellspacing, and each cell a set width and height. That should make the table size exactly x-pixels high and y-pixels wide.

Shouldn't it?
Well, I could do that, but then I run across another problem. The way that hyperlinks are created is that &nbsp; populates each cell with the link. Now I suppose I could use CSS or something to make the each <td> cell clickable. That way I could change the width of each of the cells and not worry about the whole cell not being clickable.

Posted: Wed Jul 03, 2002 10:26 am
by RandomEngy
Ahh, I see the problem now... Gotta have something to click on, and the width modifier doesn't constrain the cell when the spaces run more than the width.

Gif for fixed width?

Posted: Wed Jul 03, 2002 10:36 am
by toro
Perhaps you could use a tdot.gif (transparent dot) of a particular width and height as clickable.

This should be easier to constrain than &nbsp; -- just make sure that there are no extra spaces or new-lines inside the <td></td>.

However there are certainly some browser versions that mess this up - but, hey that's what html is like.

Toro

Posted: Wed Jul 03, 2002 10:37 am
by protokol
RandomEngy wrote:Ahh, I see the problem now... Gotta have something to click on, and the width modifier doesn't constrain the cell when the spaces run more than the width.
Yes, exactly. I just modified the code a bit and now it shouldn't be a problem though. Check it out and let me know if this is better.
http://easypim.sourceforge.net/color

Basically I did this:

Code: Select all

<td bgcolor="web_safe_code" onclick="choose_color" style="cursor: pointer">&nbsp;</td>

Posted: Wed Jul 03, 2002 11:00 am
by RandomEngy
The width is right, but it still left out the bottom row.

Posted: Wed Jul 03, 2002 11:10 am
by protokol
Ok, hehe, I promise it's fixed now:

http://easypim.sourceforge.net/color/

Posted: Wed Jul 03, 2002 11:32 am
by RandomEngy
Strange, bottom row is still not making it into the window.... maybe you can just make the window bigger and just have some white space for some people.