Einzelnen Beitrag anzeigen
Alt 13.10.2012, 09:56   #158
leecher
Moderator
SETCOL

E r g e b n i s / R e s u l t

Set an Open Access colour value

B e s c h r e i b u n g / D e s c r i p t i o n

The SETCOL function sets one of the 19 separate Open Access colours to
any of 256 combinations of background and foreground colours.

It it possible to abandon the pre-set Open Access colour schemes
completely and set your own colours on-the-fly. When you create a new
colour, you must define a foreground and a background value. There are
16 foreground colours and 8 background and 8 flashing colours.

You could change the input field colour to black on black for a password
(though, see PASSWORD function.) Or change the title colours to stand
out more prominently.

If you change the value of a colour that is already on the screen, then
that colour is not changed. So, you could print one line in the prompt
colour, change the prompt colour and the next line would appear in a
different colour. The original line would not change colour.

S y n t a x

Code:
bool = ('SETCOL' , colour , newvalue)
P a r a m e t e r

colour - The colour parameter selects the colour value to return.
There are 19 colours, numbered 0 to 18. They are -

0 Normal colour
1 Errors
2 Title
3 Prompt
4 Input fields
5 User 1 colour
6 User 2
7 Borders
8 WP normal
9 WP bold
10 WP underline
11 WP bold underline
12 WP italics
13 WP bold italics
14 WP underline italics
15 WP bold underline italics
16 Menu Items
17 Menu Bar
18 Chosen Menu item

newvalue - The new colour consists of a mix of background and foreground
colours.

The colour values are shown below -

0 Black 8 Grey
1 Blue 9 Bright Blue
2 Green 10 Bright Green
3 Cyan 11 Bright Cyan
4 Red 12 Bright Red
5 Magenta 13 Bright Magenta
6 Brown 14 Yellow
7 White 15 Bright White

The background colour is determined by taking the colour
required and multiplied by 16. Then the foreground colour
is added to that. Choosing a background colour beyond 7
causes the final colour to blink.

So, bright white on blue = 15 + (1 * 16) = 31

blue on cyan = 1 + (3 * 16) = 49

flashing bright red on blue = 12 + (9 * 16) = 156

R e t u r n s

A boolean value is returned.

B e i s p i e l / E x a m p l e

Code:
attach 'SETUP'
put call('SETCOL' , 2 , 30) ! set the TITLE colour to bright yellow on blue 
detach 'SETUP'
Q u e r v e r w e i s / C r o s s R e f e r e n c e
GETCOL
leecher ist offline   Mit Zitat antworten