Shawn McKenzie wrote: > Keikonium wrote: >> This may not be exactly what you think, but I didn't know how else to >> word the title. I basically need to make a script that will go through >> every possible color combination and print them to look just like (or >> similar) to the windows color picker. I need it in the format X-Y-Z. For >> example: >> >> 255-255-255 >> 255-254-254 >> 255-253-253 >> >> What I have so far is this: >> >> *********************** >> <?php >> $break = print"<br>"; >> $n1 = "255"; >> $n2 = "12"; >> $n3 = "186"; >> >> $output = print" >> \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3 >> penColor-$n1-$n2-$n3) >> \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3 >> pencolor-$n1-$n2-$n3,TOOLTIP:\"$n1-$n2-$n3\") >> "; >> >> $output >> ?> >> *********************** >> >> The $drawrect, $button2, and $get are NOT php functions, but to be >> printed as actual text (which is why I have escaped them with the >> backslash). Anyways, I thought it would be easiest to separate each >> R-G-B value into its own variable ($n1, $n2, and $n3). That way I could >> just use some code (regex?) to cycle through the numbers 0 to 255. >> >> The HARD part (that I can't seem to even think of a way to make it >> possible) is to change JUST the G and B values while keeping the R value >> at 255. Then when the G and B values both hit 0, the R value is set to >> 254 and repeated until it also hits 0 with the other two. I think (?) >> that will do every possible color? I also need to print each string with >> the individual color output, and I don't know how to do that either. >> >> In short, I would like something that looks just like the windows color >> picker, and when each pixel of it is clicked, it will show me the R-G-B >> value in the format I would like. >> >> If anyone understands what I am after,and could help, that would be >> awesome! > > > There are plenty of free ones available, try: > http://www.softcomplex.com/products/tigra_color_picker/ > > But to answer part of your question, this will give you the over > 16,000,000 million colors. Example only, I wouldn't run this :-) > > for($n1 = 255; $n1 >= 0; $n1 = $n1--) { > $h1 = base_convert($n1, 10, 16); > for($n2 = 255; $n2 >= 0; $n2 = $n2--) { > $h2 = base_convert($n2, 10, 16); > for($n3 = 255; $n3 >= 0; $n3 = $n3--) { > $h3 = base_convert($n3, 10, 16); > echo "$n1-$n2-$n3 ".sprintf("#%06s\n","$h1$h2$h3"); > } > } > } > > > This example will give you the web safe color pallet, 200 and some odd > colors: > > for($n1 = 255; $n1 >= 0; $n1 = $n1 - 51) { > $h1 = base_convert($n1, 10, 16); > for($n2 = 255; $n2 >= 0; $n2 = $n2 - 51) { > $h2 = base_convert($n2, 10, 16); > for($n3 = 255; $n3 >= 0; $n3 = $n3 - 51) { > $h3 = base_convert($n3, 10, 16); > echo "$n1-$n2-$n3 ".sprintf("#%06s\n","$h1$h2$h3"); > } > } > } > > -Shawn > Email editing bug. The first example the loops should be $n1-- , $n2-- , $n3-- , not $n1 = $n1-- , etc... for($n1 = 255; $n1 >= 0; $n1--) { $h1 = base_convert($n1, 10, 16); for($n2 = 255; $n2 >= 0; $n2--) { $h2 = base_convert($n2, 10, 16); for($n3 = 255; $n3 >= 0; $n3--) { $h3 = base_convert($n3, 10, 16); echo "$n1-$n2-$n3 ".sprintf("#%06s\n","$h1$h2$h3"); } } } -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php