RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

The Window Manager Colour

Programmer's Reference Manuals
» Part 7 - The Desktop
» The Window Manager
» Technical Details
» Colour

Overview

Among other aspects of its window environment the Wimp permits configuration of colour. An application has control over the colour of text, of window outlines and of many others parts. The Wimp provides different methods for managing the colour of applications:

Type Description
Basic Uses one of 16 possible colours
Advanced Uses 24-bit colour

The Wimp knows which method to use by checking the Extra Window Flags within a windows definition.

Note: The advanced approach to colour handling requires at least version x.xx of the Window Manager.

4-bit Colour

The Wimp uses 16 pre-set colours which are mapped to the available colours in the current screen mode, regardless of whether there are more or fewer available colours.

The available colours are:

Colour # Colour Default Usage
0 White
1 Grey(1) Work area background, icon bar background, scroll bar inner
2 Grey(2) Title background
3 Grey(3) Scroll bar outer
4 Grey(4) Desktop background
5 Grey(5)
6 Grey(6)
7 Black Title text, window text
8 Dark Blue
9 Yellow
10 Green
11 Red
12 Cream Title background – Input focus
13 Army Green
14 Orange
15 Light Blue

Translation

The following tables details how the Wimp maps the 16 pre-set Wimp colours within non-16 colour screen modes.

2 Colour Mode
16 Colour # Mapping
0 White
1-6 Patterned
7 Black
8-15 White or Black (closest Match)

<br \>
h5. 4 Colour Mode

16 Colour # Mapping
0 White
1 Light grey
2 Dark grey
3 Black
8-15 White or Black (closest Match)
Greater than 16 Colour Mode
Translation to closest possible colour is undertaken. However, an exact match may not always be possible.

Note: Manual translation of colours is possible if required. An application should use the ColourTrans module to achieve this

Translation Exceptions

The Wimp translates colours when the current screen mode does not match the required colour depth. The following table shows when translations occur and any exceptions.

When Exceptions
Windows Translation of colours unless explicitly told otherwise. This is set within the windows windows flags using bit 10
Sprites Colour translations are provided by the OS_SpriteOp reason code &34 (52)
Icons Patterned colours in icons cannot be displayed within 2-colour modes
Caret Translations of colours unless told otherwise

24-bit Colour

The Wimp can also handle Colours using 24-bit colour.

The table below details which parts of a window can be set with 24-bit colour.

# Window Element
1 Title text
2 Title background
3 Work area text
4 Work area background
5 Scroll bar inner
6 Scroll bar outer

The colours are in the format BBGGRR.

Translation

Where 24-bit colour has been specified for a window, but a particular window element has not got it’s colour set, then the Wimp will use the applicable default 16 colour equivalent.

Manual translation of colours is possible if required. An application should use the ColourTrans module to achieve this.

Notification

The Wimp will issue an event code when the palette changes because of a change of screen mode. This allows applications to know about the change so they can update their content.

The Wimp issues Message_ModeChange which applications should respond to so that any mode specific data can be changed.

See also

  • Wimp_OpenWindow
  • Extra Window Flags
  • Wimp_Poll
  • OS_SpriteOp
  • Message_ModeChange

For a full detailed description on colour, please see the RISC OS Style Guide.

Revised on January 29, 2010 15:04:06 by GavinWraith (26)? (127.0.0.1)
Edit | Back in time (5 revisions) | See changes | History | Views: Print | Source | Linked from: The Window Manager Technical Details, Wimp_SetColour

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys