OT raibow

OT raibow

am 30.11.2007 18:39:35 von Petr Vileta

My question is not perl specific but here are many clever people :-)
I want to generate html object with all "safe" colors but in
> rainbow order (from white over yellow, red upt to black). I want to use
> hexadecimal values for RGB but only 0,33,66,99,cc and ff values. Please
> know anybody some algorithm how to do it?

A rainbow contains just the "unmixed" colors in the visible spectrum so
it does not contain white or black and also misses a few other colors:
http://en.wikipedia.org/wiki/Visible_spectrum

If that's not a problem, see:
http://www.philiplaven.com/p19.html
http://www.midnightkite.com/color.html

Joost.

Re: OT raibow

am 30.11.2007 20:54:14 von Ben Morrow

Quoth "Petr Vileta" :
> My question is not perl specific but here are many clever people :-)

....who are here to discuss Perl. Take your question elsewhere.

Ben

Re: OT raibow

am 01.12.2007 02:57:59 von Tad McClellan

Petr Vileta wrote:

> My question is not perl specific but here are many clever people :-)


Folks who knowingly make off topic posts get stiffer scorefile entries.

Hope it was worth it...


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"

Re: OT raibow

am 01.12.2007 04:37:25 von Petr Vileta

Joost Diepenmaat wrote:
> On Fri, 30 Nov 2007 18:39:35 +0100, Petr Vileta wrote:
>
>> I want to generate html object with all "safe" colors but in
>>> rainbow order (from white over yellow, red upt to black). I want to
>>> use hexadecimal values for RGB but only 0,33,66,99,cc and ff values.
>>> Please know anybody some algorithm how to do it?
>>
>> A rainbow contains just the "unmixed" colors in the visible spectrum
>> so it does not contain white or black and also misses a few other
>> colors: http://en.wikipedia.org/wiki/Visible_spectrum
>>
>> If that's not a problem, see:
>> http://www.philiplaven.com/p19.html
>> http://www.midnightkite.com/color.html
>>
>> Joost.
> Thank you Joost, but my problem is a bit different. Not all internet user can
> see thousands or milions colors on display (e.g. on mobile phone), but most
> people can see 256 color. In addition to this fe years ago somebody define set
> of colors called "safe colors".

Quite a bad name. These colors were never "safe" in the sense that the
inventor intended. It assumes that on a system with 256 colors there are
less than 40 colors already in use - but that's not guaranteed, and if
there are less than 216 colors "free" browsers resort to a smaller cube
with totally different colors. So forget the "safe" colors and use the
colors you want and make sure that there is enough contrast between
colors you want to distinguish even if the display can only approximate
them.


> I'm looking for some algorithm what generate the same table but more similar
> to rainbow.

Convert from RGB to HSV then sort by H.

hp


--
_ | Peter J. Holzer | It took a genius to create [TeX],
|_|_) | Sysadmin WSR | and it takes a genius to maintain it.
| | | hjp@hjp.at | That's not engineering, that's art.
__/ | http://www.hjp.at/ | -- David Kastrup in comp.text.tex

Re: OT raibow

am 01.12.2007 23:16:33 von Martijn Lievaart

On Sat, 01 Dec 2007 16:20:51 +0000, A. Sinan Unur wrote:

> "Petr Vileta" wrote in
> news:fipin5$vsd$1@ns.felk.cvut.cz:
>
>> My question is not perl specific but here are many clever people :-)
>
> You don't see me asking for restaurant recommendations here, do you?

Ah, but you don't need clever people for restaurant recommendations, now
do you? :-)

[ Don't get me wrong, the question /is/ OT. ]

M4

Re: OT raibow

am 02.12.2007 00:18:52 von Scott Bryce

Peter J. Holzer wrote:
> Convert from RGB to HSV then sort by H.

This might help.

http://search.cpan.org/~aizvorski/Graphics-ColorObject-0.5.0 /ColorObject.pm

Re: OT raibow

am 02.12.2007 01:35:53 von Ilya Zakharevich

[A complimentary Cc of this posting was sent to
Joost Diepenmaat
], who wrote in article <4750698f$0$18641$e4fe514c@dreader28.news.xs4all.nl>:
> A rainbow contains just the "unmixed" colors in the visible spectrum so

A rainbow contains VERY mixed colors. It's a wonder that these colors
are distinguishable by eye at all; they are very low saturation (even
if the background is very dark - which it usually is not).

[Very OT:] assuming ideally spherical form of water droplets, it
should not be hard to calculate position of rainbow colors
on the color triangle; have anyone seen this "published"?

Thanks,
Ilya

Re: OT raibow

am 02.12.2007 02:00:24 von Joost Diepenmaat

On Sun, 02 Dec 2007 00:35:53 +0000, Ilya Zakharevich wrote:
> A rainbow contains VERY mixed colors. It's a wonder that these colors
> are distinguishable by eye at all; they are very low saturation (even if
> the background is very dark - which it usually is not).

Getting further and further off-topic.

I am under the impression that a rainbow contains/is a "frequency sweep"
of visible light, which would mean that the colors aren't mixed - at
every point you'd have light of a single frequency.

The way the human eye actually processes light means visible light is
processed as a mixture of stimuli to the 3 types of cone cells, but
looking at the wiki page*, it seems that all colours except the ones at
the far ends of the spectrum are detected by at least 2 of the 3 types of
cell.

If you mean that real-life rainbows are mixed with light from all kinds
of other sources, and don't just contain a plain spectrum, I agree.

* http://en.wikipedia.org/wiki/Color_vision

Joost.

Re: OT raibow

am 02.12.2007 02:59:34 von Petr Vileta

Klaus wrote:
> On Dec 1, 4:37 am, "Petr Vileta" wrote:
>> open H,"> colors.htm";
>
> this is better written using lexical filehandles, open with three
> arguments and test for failure:
> open my $H, '>', 'colors.htm' or die "Error open 'colors.htm', reason: $!";
>
Sorry, I forgot to mention about my Perl version - 5.6.1 ;-)
In addition to this an "or die..." part is not needed for short test-type
scripts when I'm sure about a privileges for directory where script is running
;-)

>> I'm looking for some algorithm what generate the same table but more
>> similar to rainbow. I mean that all red tones will be together, all
>> yellow tones will be together etc. in right order.
>
> http://search.cpan.org/~dland/HTML-Rainbow-0.05/Rainbow.pm

Hurry :-) This is what I'm looking for. Thank you very much. This module work
with character's color and I need to work with background color, but I use and
idea and write some similar.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to

Re: OT raibow

am 02.12.2007 03:02:36 von Petr Vileta

A. Sinan Unur wrote:
> "Petr Vileta" wrote in
> news:fipin5$vsd$1@ns.felk.cvut.cz:
>
>> My question is not perl specific but here are many clever people :-)
>
> You don't see me asking for restaurant recommendations here, do you?
>
> Sinan
No, thanks ;-) I not need to know good restaurants, but many people here use
Perl for webs and trafic in groups about html or www is 1 message per month
:-(
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to

Re: OT raibow

am 02.12.2007 12:44:24 von Michele Dondi

On Sun, 2 Dec 2007 02:59:34 +0100, "Petr Vileta"
wrote:

>> this is better written using lexical filehandles, open with three
>> arguments and test for failure:
>> open my $H, '>', 'colors.htm' or die "Error open 'colors.htm', reason: $!";
>>
>Sorry, I forgot to mention about my Perl version - 5.6.1 ;-)
>In addition to this an "or die..." part is not needed for short test-type
>scripts when I'm sure about a privileges for directory where script is running
>;-)

You don't take into account that people could search clpmisc for past
posts. Better let anyone see the ordieish part. At the very least just
put C there. And a smarter answer would have been that you
had

use Fatal 'open';

at the top of your script ;)


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: OT raibow

am 02.12.2007 13:04:02 von Michele Dondi

On 02 Dec 2007 01:00:24 GMT, Joost Diepenmaat wrote:

>> A rainbow contains VERY mixed colors. It's a wonder that these colors
>> are distinguishable by eye at all; they are very low saturation (even if
>> the background is very dark - which it usually is not).
>
>Getting further and further off-topic.

Getting even further offtopic: "Just like a rainbow/you know you set
me free/and I just can't get enough/I just can't get enough."

>I am under the impression that a rainbow contains/is a "frequency sweep"
>of visible light, which would mean that the colors aren't mixed - at
>every point you'd have light of a single frequency.

You're under a wrong impression since strictly speaking light "of a
single frequency" does not exist: all wave packets are spreaded a
little.

>The way the human eye actually processes light means visible light is
>processed as a mixture of stimuli to the 3 types of cone cells, but
>looking at the wiki page*, it seems that all colours except the ones at
>the far ends of the spectrum are detected by at least 2 of the 3 types of
>cell.

Yes, the eye and the ear are very different instruments, with the
latter beying a Fourier transform calculator and the former in some
sense a much rougher one, except for the spatial resolution.
Incidentally I've hear rumors about some researches suggesting that
some people may have a fourth type of cone cells.


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Re: OT raibow

am 02.12.2007 14:54:20 von rvtol+news

Petr Vileta schreef:

> Sorry, I forgot to mention about my Perl version - 5.6.1 ;-)

http://maddingue.free.fr/conferences/fpw-2007/old-perls/

(5.6 has the 3-argument open)

--
Affijn, Ruud

"Gewoon is een tijger."

Re: OT raibow

am 02.12.2007 16:38:21 von Tad McClellan

Petr Vileta wrote:


[ snip checking the return value from open() ]


> an "or die..." part is not needed for short test-type
> scripts when I'm sure about a privileges for directory

^
^
When you post code for the whole world to see, then that should
be extended to:

when everyone who sees this code is sure about a privileges for directory

Many people reading this group are learning Perl from it. The may well
copy/paste code found here into their real programs.

"Seeding" the world with poorly formed code is a disservice to the community.

When you post here, the audience that your article is written for is not
really "you", it is to dozens or hundreds or thousands of "us".

(and it is also not seen just "now", it may be seen years from now
in a newsgroup archive.
)


> ;-)

(smiley noted)


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"

Re: OT raibow

am 03.12.2007 01:42:15 von Ilya Zakharevich

[A complimentary Cc of this posting was sent to
Joost Diepenmaat
], who wrote in article <475203a8$0$20387$e4fe514c@dreader32.news.xs4all.nl>:
> On Sun, 02 Dec 2007 00:35:53 +0000, Ilya Zakharevich wrote:
> > A rainbow contains VERY mixed colors. It's a wonder that these colors
> > are distinguishable by eye at all; they are very low saturation (even if
> > the background is very dark - which it usually is not).
>
> Getting further and further off-topic.
>
> I am under the impression that a rainbow contains/is a "frequency sweep"
> of visible light, which would mean that the colors aren't mixed - at
> every point you'd have light of a single frequency.

It is very very far from being true. Looking at the picture of ray
tracing through a droplet, you can see that there is A CONCENTRATION
of rays going out near a certain cone; as with "the usual `fold'
concentrators" (see catastrophe theory) the corresponding density will
be about const/sqrt(A-a0); here A is the angle with the direction to the
sun, and a0 the angle at the vertex of the cone. a0 depends slightly
on the frequency of light.

Therefore, looking in the particular direction A, you get density of
rainbow light with frequency F as const/sqrt(A - a0(F)); this may be
rewritten as something "about const/sqrt(F - F0)". "Single frequency"
conjecture corresponds to distribution with density concentrated at
one particular frequency F0.

Since dependence of a0 on F is very small, this "about" above should
give quite good an approximation; thus the distribution is "very
wide", not "very narrow".

Hope this helps,
Ilya

Re: OT raibow

am 03.12.2007 02:41:34 von Petr Vileta

Tad McClellan wrote:
> Petr Vileta wrote:
>
>> an "or die..." part is not needed for short test-type
>> scripts when I'm sure about a privileges for directory
>
> ^
> ^
> Many people reading this group are learning Perl from it. The may well
> copy/paste code found here into their real programs.
>
> "Seeding" the world with poorly formed code is a disservice to the
> community.
>
> When you post here, the audience that your article is written for is
> not really "you", it is to dozens or hundreds or thousands of "us".
>

Yes, you are right. I redeem myself :-)

--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to

Re: OT raibow

am 03.12.2007 21:10:16 von Joost Diepenmaat

> Hope this helps,
> Ilya

Ok, I'll have to take a closer look at this subject if I'm ever going to
understand it correctly. I can't visualize your explanation at all -
though I think I get the gist of what you're saying - but some reading
already convinced me it wasn't as simple as I initially thought.

On a lighter note:

http://imgs.xkcd.com/comics/electromagnetic_spectrum.png

Thanks for taking the time,
Joost.

Re: OT raibow

am 04.12.2007 15:59:24 von Lars Haugseth

* "Peter J. Holzer" wrote:
>
> On 2007-12-01 03:37, Petr Vileta wrote:
> > I'm looking for some algorithm what generate the same table but more similar
> > to rainbow.
>
> Convert from RGB to HSV then sort by H.

How should the shades of grey be sorted, ie. where do they
fit in a rainbow-like ordering? :-)

--
Lars Haugseth

"If anyone disagrees with anything I say, I am quite prepared not only to
retract it, but also to deny under oath that I ever said it." -Tom Lehrer

Re: OT raibow

am 04.12.2007 16:16:56 von Lars Haugseth

* "Petr Vileta" wrote:
>
> A. Sinan Unur wrote:
> > "Petr Vileta" wrote in
> > news:fipin5$vsd$1@ns.felk.cvut.cz:
> >
> >> My question is not perl specific but here are many clever people :-)
> >
> > You don't see me asking for restaurant recommendations here, do you?
>
> No, thanks ;-) I not need to know good restaurants, but many people
> here use Perl for webs and trafic in groups about html or www is 1
> message per month :-(

The cause of that particular traffic problem is that people post their
www and html related questions in groups dedicated to Perl programming.

--
Lars Haugseth

"If anyone disagrees with anything I say, I am quite prepared not only to
retract it, but also to deny under oath that I ever said it." -Tom Lehrer

Re: OT raibow

am 05.12.2007 04:35:18 von Petr Vileta

Lars Haugseth wrote:
> * "Peter J. Holzer" wrote:
>>
>> On 2007-12-01 03:37, Petr Vileta wrote:
>>> I'm looking for some algorithm what generate the same table but
>>> more similar to rainbow.
>>
>> Convert from RGB to HSV then sort by H.
>
> How should the shades of grey be sorted, ie. where do they
> fit in a rainbow-like ordering? :-)

In context to my primary question this is very simple :-)

#FFFFFF
#CCCCCC
#999999
#666666
#333333
#000000

--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to

Re: OT raibow

am 05.12.2007 04:37:57 von Petr Vileta

Lars Haugseth wrote:
>>> You don't see me asking for restaurant recommendations here, do you?
>>
>> No, thanks ;-) I not need to know good restaurants, but many people
>> here use Perl for webs and trafic in groups about html or www is 1
>> message per month :-(
>
> The cause of that particular traffic problem is that people post their
> www and html related questions in groups dedicated to Perl
> programming.

You are not right. Many times I sent something to www newsgroup but I was be a
single man there :-)
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to

Re: OT raibow

am 05.12.2007 14:54:35 von 1usa

"Petr Vileta" wrote in
news:fj57a0$f6i$2@ns.felk.cvut.cz:

> Lars Haugseth wrote:
>>>> You don't see me asking for restaurant recommendations here, do
>>>> you?
>>>
>>> No, thanks ;-) I not need to know good restaurants, but many people
>>> here use Perl for webs and trafic in groups about html or www is 1
>>> message per month :-(
>>
>> The cause of that particular traffic problem is that people post
>> their www and html related questions in groups dedicated to Perl
>> programming.
>
> You are not right. Many times I sent something to www newsgroup but I
> was be a single man there :-)

I am not sure what the smiley means in this case.

comp.infosystems.www.authoring.html
comp.infosystems.www.authoring.stylesheets
comp.infosystems.www.authoring.site-design

are all active groups where I lurk.

I know that

comp.infosystems.www.authoring.cgi

has been practically defunct for a while now.

In any case, even if all those groups were gone, that still would not
justify posting off-topic messages on clpmisc.

Sinan

--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
clpmisc guidelines:

Re: OT raibow

am 05.12.2007 16:24:37 von Petr Vileta

A. Sinan Unur wrote:
> "Petr Vileta" wrote in
> news:fj57a0$f6i$2@ns.felk.cvut.cz:
>
>> You are not right. Many times I sent something to www newsgroup but I
>> was be a single man there :-)
>
> I am not sure what the smiley means in this case.
>
> comp.infosystems.www.authoring.html
> comp.infosystems.www.authoring.stylesheets
> comp.infosystems.www.authoring.site-design
>
Thank you, I didn't know about comp.infosystems news server. I'm going to add
this server to my news reader right now.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to

Re: OT raibow

am 06.12.2007 11:10:56 von Michele Dondi

On Wed, 5 Dec 2007 16:24:37 +0100, "Petr Vileta"
wrote:

>> I am not sure what the smiley means in this case.
>>
>> comp.infosystems.www.authoring.html
>> comp.infosystems.www.authoring.stylesheets
>> comp.infosystems.www.authoring.site-design
>>
>Thank you, I didn't know about comp.infosystems news server. I'm going to add
>this server to my news reader right now.

I don't think it's a *news server*, just a hierarchy...


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^ ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,