Hex Codes

R

rf

Er, what do you mean by "color codes only". The script *does* output only
colour codes.
I ran the script in EditPlus and stopped it midway when I realised
what it was doing; the first few rgb values it outputted were
obviously alien to me though I notice you did limit it to 0 - 255 ;)

What is alien about #000000, it's black, or #00007f, its mid blue, #0000ff,
its bright blue?

Ok, #000100 might be uncommon, being the darkest green there is but it's
still a colour.

This script simply outputs the 16,777,216 possible colours, just because you
have not seen one of them before does not make it "not a colour" :)

Cheers
Richard.
 
K

kayodeok

Er, what do you mean by "color codes only". The script *does*
output only colour codes.

I let EditPlus handle the output in its output window; it scrolled
by so fast that I obviously missed the most recognisable colors -
not all of use the full spectrum of colors you know...
What is alien about #000000, it's black, or #00007f, its mid
blue, #0000ff, its bright blue?

Obviously, I didn't notice the above colors! It was Christmas day
and I wanted to have a very quick look before saving the script and
joining the fun.

I did a quick scan of the output and it was scrolling by very fast
and I missed the clues - only way I could have spotted them was to
output to a text file but this is a job for another time and the
code DOES limit it to 0 - 255 (which I obviously missed in my first
post).

It was Christmas Day so give me a break :)
 
R

Ryan Stewart

kayodeok said:
Obviously, I didn't notice the above colors! It was Christmas day
and I wanted to have a very quick look before saving the script and
joining the fun.

Um, you are aware that any six digit hex number is a valid color code?
 
K

kayodeok

Um, you are aware that any six digit hex number is a valid color
code?

Here is David's Script again:

#!/usr/bin/perl

use strict;

for (0 .. 255) {
my $a = $_;
for (0 .. 255) {
my $b = $_;
for (0 .. 255) {
my $c = $_;
printf ("#%X%X%X\n", $a, $b, $c);
}
}
}

Here is my usage of David's script:

perl hexcodes.pl > hexcodes.txt

The output of hexcodes.txt was 100 Megabytes before I terminated the
process - obviously, EditPlus couldn't open the file, Ms Word
couldn't, so I linked it to an MS Access Database and grabbed a few
lines for evidence.

I think someone ought to run it in a Windows Environment to see what
I saw when I terminated it on Christmas Day. I took a look at the
script with my newbie eyes but I couldn't find anything wrong.

This is a section of what I saw in Editplus's Output Window on
Christmas Day before my post to David (I only allowed it to run for a
few seconds before terminating the output window on christmas day):

I have posted the first 20 lines:

#000
#001
#002
#003
#004
#005
#006
#007
#008
#009
#00A
#00B
#00C
#00D
#00E
#00F
#0010
#0011
#0012
#0013

MS Access tells me that the 100mb file has 12,483,163 lines.

I am used to associating black with #000000 (though I use #000 in my
style-sheets), in any case, I couldn't have seen #000 since Perl is
fast and I was using the Output Window but I definitely terminated
the script before any six figures began to show up (it was still
outputting 4 figures).
 
D

David Dorward

kayodeok said:
I have posted the first 20 lines:

#000

Darn, its buggy. It doesn't insert leading zeros.

Change the printf line to:

printf ("#%02X%02X%02X\n", $a, $b, $c);

and I think it will work.
 
K

kayodeok

Darn, its buggy. It doesn't insert leading zeros.

Change the printf line to:

printf ("#%02X%02X%02X\n", $a, $b, $c);

and I think it will work.

Thanks!

I am running it now in Editplus's output window and it is ok so far
and producing Hex Codes I can recognise.

Regards
 
G

Guest

Jukka K. Korpela said:
No, you don't. You're seriously misguided if you think you do.
(We might help you out of your problems if you told us how you got
there.)
Actually I find it easier to write the name than remember the code......so
please don't tell me I am misguided. You don't know me at all how dare you
judge.
 
D

David Dorward

Actually I find it easier to write the name than remember the code......

So did I... until I bothered to learn how it works.

And given that there are 16,777,216* colours that can be specified in
hecidecimal form, and 16** which can be specified by name in HTML
you rather limit yourself if said:
so please don't tell me I am misguided. You don't know me at all how dare
you judge.

* If my sums are right
** Not counting the X Windows System colours which many browsers support but
which aren't in HTML.
 
J

Jukka K. Korpela

Spam h8tr said:
Actually I find it easier to write the name than remember the
code......

That's understandable.
so please don't tell me I am misguided.

That's exactly why I'm telling you that.
You don't know me at all how dare you judge.

I know the facts, and you don't. Whether we know each other is
immaterial.

There are sixteen (16) named colors, and you can find those names in
the HTML specification. Those names aren't of much use in practice, but
that's what you have. All the other names you might find elsewhere are
undefined in HTML terms - some browsers might recognize them, and treat
them the way they like.
 
R

rf

Spam h8tr said:
Actually I find it easier to write the name than remember the code......so
please don't tell me I am misguided. You don't know me at all how dare you
judge.

Without even knowing you I would say you are misguided if you think you need
to know the names of each of the 16,777,216 possible colours.

Cheers
Richard.
 
W

William Tasso

rf said:
Without even knowing you I would say you are misguided if you think
you need to know the names of each of the 16,777,216 possible colours.

Don't be too hard on him/her - everyone needs a hobby.
 
G

Guest

William Tasso said:
Don't be too hard on him/her - everyone needs a hobby.
Yes I do need a hobby...but sorry for snapping....bad hair day
prehaps?......take my weird type of apology. :)
 
R

rf

William Tasso said:
Don't be too hard on him/her - everyone needs a hobby.

Read an SF story once (Azimov IIRC)...

Thousands of years ago some monks decided that to write down all the billion
names of &deity; on a piece of paper would bring nirvana. They of course
started with "a", proceeded to "aa" and "aaa" and went on from there.

They were well into the "c"s when the computer age dawned. An enterprising
..com company sold them a brand new 4GHz machine with a real fast laser
printer (at a Very Good Price), able to complete the task, right down to
"zzzzz..." in just twenty five minutes.

As they walked away, smirking to themselves, the two installation
technicians failed to notice the universe quietly dissolving behind them :-(

Cheers
Richard.
 
W

William Tasso

rf said:
Read an SF story once (Azimov IIRC)...

Thousands of years ago some monks decided that to write down all the
billion names of &deity; on a piece of paper would bring nirvana.
They of course started with "a", proceeded to "aa" and "aaa" and went
on from there.

They were well into the "c"s when the computer age dawned. An
enterprising .com company sold them a brand new 4GHz machine with a
real fast laser printer (at a Very Good Price), able to complete the
task, right down to "zzzzz..." in just twenty five minutes.

As they walked away, smirking to themselves, the two installation
technicians failed to notice the universe quietly dissolving behind
them :-(

In a similar vein (and seeing as we are now flying under an OT banner) I
heard a story on the radio a long while back. It was about a very special
word processor that did as it was told. For example the command 'delete
clouds' resulted in clear skies. You can imagine the rest.
 
R

rf

In a similar vein (and seeing as we are now flying under an OT banner) I
heard a story on the radio a long while back. It was about a very special
word processor that did as it was told. For example the command 'delete
clouds' resulted in clear skies. You can imagine the rest.

Wow :eek:) I *want* one of those. There is this pesky customer over there ---->

Cheers
Richard.
 
N

Nick Theodorakis

On Sun, 28 Dec 2003 10:51:48 -0000, "William Tasso"

[...]
In a similar vein (and seeing as we are now flying under an OT banner) I
heard a story on the radio a long while back. It was about a very special
word processor that did as it was told. For example the command 'delete
clouds' resulted in clear skies. You can imagine the rest.

It looks like you're controlling the weather.
Would you like help?

* Get help with controlling the weather
* Just control the weather without help


Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top