comp.lang.ada
 help / color / mirror / Atom feed
From: "Sybs ALHABSHI" <sybs@htsavoie.com>
Subject: Re: how do i include 111111 in an enumaration type ?
Date: 1999/10/14
Date: 1999-10-14T14:00:57+00:00	[thread overview]
Message-ID: <7u4nmp$n1b$1@minus.oleane.net> (raw)
In-Reply-To: 3802C50A.A5565DDA@callnetuk.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3974 bytes --]

I'm impressed by all the discussion and hints in this thread. I'm lost.
It'll take me some time to understand what you're all taking about. Thank
you all. I've learned quite a bit.

I use ObjectAda 7.1 on NT4.0, and I've managed to built a function that
generates the hex color values in real time as well as text colors matching
the background through sliders in a simple interface created with
GuiBuilder. It works fine and it generates instantly the webpage with the
text in the matching colour with one button click.

But here, I'd like to attach names to these values, "AdaHome Green" for
exemple to color="#99ccbb" ( the background color of adahome.). In many
graphic applications, in fashion design etc, color names ( some of them
poetic and very beautiful) has a significant meaning. Fashion designers,
graphic artistes spend hours matching colours, and certain harmonies
patterns are such that you sometimes imagine colours that "aren't there".
There are so many palettes to consider, and ofcoarse, as a  web designer, I
figure it'll be okay if I can define a type 000000 to FFFFFF, then break
down to sub types of colors that may describe lifestyles, cultures, color
codes, fashion, industries, whatever, as this has become sort of an
international standard of defining colors, and an acceptable manner of
communicating colour schemes ( screen limitations apart  ). I also wonder if
I can find a much faster and convenient way of matching what I see on my
screen to the hardcopy printer's color scale or brushstroke without going
through all the complicated calibration systems, by say simply shifting the
values of a sub-type. Which means that the hex values defined in the subtype
may vary with the shift, but the names attached relatively to one another
may remain the same. So in fact, the names (Indian Red, Canyon Vermillion,
Sunset Orange) may refer to three values that can either be 4,5,6, or 5,6,7
or again 3,4,5. So many things I can do with this...

The other domaine in which I'd like to apply this, is the attachement of
town names to postal codes. In France, 75000 is Paris. 73370 is for " La
Chapelle du Mont du Chat". No shifting here...

But from what I undestand, 111111 cannot be in an enumeration type. Period.
Alas ! But maybe records has the solution...

Nick Roberts <nickroberts@callnetuk.com> a �crit dans le message :
3802C50A.A5565DDA@callnetuk.com...
> Sybs ALHABSHI wrote:
> > In the enumaration type declaration, the string of caracters 000000 is
taken
> > as a numerical expression.
> >
> > Can anyone explain how  I can get around this ?
> >
> >         type webcolor is (FFFFFF, 000000);
>
> Sybs,
>
> I wonder if an enumeration type is what you are looking for here?  Take
> a look at the following snippet of code.
>
>    type Monochromatic_Level is mod 256; -- i.e. a byte
>
>    type RGB_Color is
>       record
>          Red, Green, Blue: Monochromatic_Level;
>       end record;
>
>    Absolute_Black: constant RGB_Color := (16#00#, 16#00#, 16#00#);
>    Absolute_White: constant RGB_Color := (16#FF#, 16#FF#, 16#FF#);
>
>    function Hex_Image (Level: Monochromatic_Level) return String is
>       Digit: constant array (Monochromatic_Level range 0..15) :=
>          ('0', '1', '2', '3', '4', '5', '6', '7',
>           '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
>    begin
>       return Digit(Level/16) & Digit(Level mod 16);
>    end;
>
>    function Hex_Image (RGB: RGB_Color) return String is
>    begin
>       return Hex_Image(RGB.Red) &
>              Hex_Image(RGB.Green) &
>              Hex_Image(RGB.Blue);
>    end;
>
>    ...
>
>       Put(Web_File,"<BODY");
>       Put(Web_File," bgcolor=#");
>       Put(Web_File,Hex_Image(Background_Color));
>       Put(Web_File," text=#");
>       Put(Web_File,Hex_Image(Text_Color));
>       ...
>
> Hope this gives you a few ideas.
>
> --
> Nick Roberts
> Computer Consultant (UK)
> http://www.callnetuk.com/home/nickroberts
> http://www.adapower.com/lab/adaos






      reply	other threads:[~1999-10-14  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7tsq3o$92p$1@minus.oleane.net>
     [not found] ` <38021792_4@news1.prserv.net>
     [not found]   ` <slrn80495c.2a2.aidan@skinner.demon.co.uk>
1999-10-11  0:00     ` how do i include 111111 in an enumaration type ? Keith Thompson
1999-10-12  0:00   ` Sybs ALHABSHI
1999-10-12  0:00     ` Matthew Heaney
1999-10-12  0:00       ` Ehud Lamm
1999-10-12  0:00     ` Lutz Donnerhacke
1999-10-12  0:00       ` Matthew Heaney
1999-10-12  0:00         ` Lutz Donnerhacke
1999-10-12  0:00           ` Ted Dennison
1999-10-12  0:00           ` Ted Dennison
1999-10-13  0:00             ` Lutz Donnerhacke
1999-10-13  0:00               ` Matthew Heaney
1999-10-13  0:00                 ` Ted Dennison
1999-10-12  0:00 ` Nick Roberts
1999-10-14  0:00   ` Sybs ALHABSHI [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox