Color Grid & Palette¶
DAColorGridWidget provides a basic color grid, and DAColorPaletteGridWidget builds on it to create an Office-style color palette (primary colors + auto-generated lighter/darker rows).
DAColorGridWidget¶

A basic color grid: swatches are laid out by column count and support checkable exclusive selection. Clicking a swatch emits colorClicked, shown in the echo label below.
Key Features¶
- ✅ Grid layout: QGridLayout + QButtonGroup
- ✅ Configurable column count:
setColumnCount(int) - ✅ Custom color list:
setColorList(QList<QColor>) - ✅ Checkable:
setColorCheckable(bool) - ✅ Adjustable size:
setColorIconSize(QSize),setSpacing(int)
Usage¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
DAColorPaletteGridWidget¶

An Office-style palette: the first row holds the primary colors and the five rows below are generated by setFactor() (positive lightens, negative darkens). Clicking any swatch emits colorClicked — the same structure as Office's theme color panel.
Key Features¶
- ✅ Office style: Primary color row + auto-generated lighter rows + darker rows
- ✅ Light/dark factors:
setFactor(QList<int>)controls the number of generated rows and their lightness/darkness - ✅ Composed of two grids: Internally uses two
DAColorGridWidgetinstances
Usage¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
How It Works¶
1 2 3 4 5 6 7 8 9 10 11 12 | |
Factor Values
Each factor in setFactor() is a percentage. Positive values lighten the color (toward white); negative values darken it (toward black). The order of factors determines the order of rows in the palette.
Core Properties & Methods¶
DAColorGridWidget¶
| Method | Description |
|---|---|
setColumnCount(int) |
Set the column count |
setColorList(QList<QColor>) |
Set the color list |
setColorIconSize(QSize) |
Set the color block size |
setSpacing(int) |
Set the spacing |
setColorCheckable(bool) |
Enable/disable checkable selection |
currentCheckedColor() |
Get the currently checked color |
DAColorPaletteGridWidget¶
| Method | Description |
|---|---|
setColorList(QList<QColor>) |
Set the primary color list |
setFactor(QList<int>) |
Set the light/dark factors |
setColorIconSize(QSize) |
Set the color block size |
setColorCheckable(bool) |
Enable/disable checkable selection |