Sign in Join
Wiki copytemporary

ColorPalette

English · Français

About

ColorPalette ColorPalette is a cross-platform color palette grid with ability to select a color from a palette. The OnMouseColorPick event is fired when the user clicks onto a color.

Authors

Tom Gregorovic and Werner Pamler

License

Modified LGPL

Usage

Color selection

When a color is selected by clicking with the mouse onto a color box an event OnColorPick is generated; the event gets the rgb value of the picked color as a parameter. Another parameter passes the ShiftState active during the click; usually this identifies the mouse button pressed. If the property ShowSelection is turned on then the picked color is highlighted.

The time flow when exactly the color is selected is determined by the property PickMode:

Palettes

Built-in palettes

The components supports a series of built-in palettes as determined by the PaletteKind property:

Custom palettes and palette files

In addition, a custom palette can be loaded from a file by calling the LoadPalette method. The palette files are simple text files according to this example (see also Default.pal in the component folder):

pascal
Custom palette example:
pascal
$COLS 8
# sets count of palette grid columns
pascal
0,0,0
# inserts color r,g,b colorname
# colorname is optional.
255,255,255 White
pascal
$NONE
# inserts empty palette grid cell
pascal
$BLENDWB 128,128,128 3
# creates color gradient white -> color -> black with specified steps
# The specified steps are applied to the transitions between "white" and "color"
# and between "color" and "black", i.e., in total, there are <tt>2*steps+1</tt> color boxes.

A set of keywords is defined to identify the palette file entries:

Methods and properties for color access

There are several methods and properties to manipulate and query the entries of the used palette:

Other properties

Layout

Visual appearance

Hints

Demo projects

Two demo projects are contained in the folder demo of the component installation directory:

Download and installation

text
svn checkout https://svn.code.sf.net/p/lazarus-ccr/svn/components/colorpalette

Change Log

Version 0.2

Version 0.1


From the Free Pascal wiki, page "ColorPalette", as it stood on 2016-06-21 after a change by Arent, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 4, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.