| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
ColorUtils Class Reference

Utility class providing color conversion, blending, and theme-aware UI color definitions. More...

`#include <color_utils.h>`

Inheritance diagram for ColorUtils:

## Public Member Functions
| ColorUtils (QObject *parent=0)
| Constructs a new ColorUtils object.

## Static Public Member Functions
static QColor | fromColorT (const color_t *color)
| Converts a core color_t pointer to a QColor.
static QColor | fromColorT (color_t color)
| Converts a core color_t value to a QColor.
static const color_t | toColorT (const QColor color)
| Converts a QColor to a core color_t.
static QRgb | alphaBlend (const QColor &color1, const QColor &color2, qreal alpha)
| Blends two colors together using the specified alpha factor.
static QRgb | alphaBlend (const QBrush &brush1, const QBrush &brush2, qreal alpha)
| Blends the colors of two brushes together using the specified alpha factor.
static QBrush | themeLinkBrush ()
| Returns an appropriate link color for the current mode.
static QString | themeLinkStyle ()
| Returns an appropriate HTML+CSS link style for the current mode.
static const QColor | hoverBackground ()
| Returns an appropriate background color for hovered abstract items.
static const QColor | warningBackground ()
| Returns an appropriate warning background color for the current mode.
static const QColor | disabledForeground ()
| Returns an appropriate foreground color for disabled text.

## Detailed Description

Utility class providing color conversion, blending, and theme-aware UI color definitions.

## Constructor & Destructor Documentation

## ◆ ColorUtils()

ColorUtils::ColorUtils | ( | QObject * | parent = 0 | ) |
| explicit

Constructs a new ColorUtils object.

Parameters

  parent | The parent QObject, defaults to 0.

## Member Function Documentation

## ◆ alphaBlend() [1/2]

QRgb ColorUtils::alphaBlend | ( | const QBrush & | brush1,
|  | const QBrush & | brush2,
|  | qreal | alpha )
| static

Blends the colors of two brushes together using the specified alpha factor.

Parameters

  brush1 | The first brush.
  brush2 | The second brush.
  alpha | The alpha blending factor.

Returns
  The blended color as a QRgb value.

## ◆ alphaBlend() [2/2]

QRgb ColorUtils::alphaBlend | ( | const QColor & | color1,
|  | const QColor & | color2,
|  | qreal | alpha )
| static

Blends two colors together using the specified alpha factor.

Parameters

  color1 | The first color.
  color2 | The second color.
  alpha | The alpha blending factor.

Returns
  The blended color as a QRgb value.

## ◆ disabledForeground()

const QColor ColorUtils::disabledForeground | ( |  | ) |
| static

Returns an appropriate foreground color for disabled text.

Returns
  The foreground color.

## ◆ fromColorT() [1/2]

QColor ColorUtils::fromColorT | ( | color_t | color | ) |
| static

Converts a core color_t value to a QColor.

Parameters

  color | The core color_t structure.

Returns
  The corresponding QColor.

## ◆ fromColorT() [2/2]

QColor ColorUtils::fromColorT | ( | const color_t * | color | ) |
| static

Converts a core color_t pointer to a QColor.

Parameters

  color | Pointer to the core color_t structure.

Returns
  The corresponding QColor.

## ◆ hoverBackground()

const QColor ColorUtils::hoverBackground | ( |  | ) |
| static

Returns an appropriate background color for hovered abstract items.

Returns
  The background color.

## ◆ themeLinkBrush()

QBrush ColorUtils::themeLinkBrush | ( |  | ) |
| static

Returns an appropriate link color for the current mode.

Returns
  A brush suitable for setting a text color.

## ◆ themeLinkStyle()

QString ColorUtils::themeLinkStyle | ( |  | ) |
| static

Returns an appropriate HTML+CSS link style for the current mode.

Returns
  A "<style>a:link { color: ... ; }</style>" string

## ◆ toColorT()

const color_t ColorUtils::toColorT | ( | const QColor | color | ) |
| static

Converts a QColor to a core color_t.

Parameters

  color | The QColor to convert.

Returns
  The corresponding core color_t structure.

## ◆ warningBackground()

const QColor ColorUtils::warningBackground | ( |  | ) |
| static

Returns an appropriate warning background color for the current mode.

Returns
  The background color.

The documentation for this class was generated from the following files:

- /builds/wireshark/wireshark/ui/qt/utils/color_utils.h
- /builds/wireshark/wireshark/ui/qt/utils/color_utils.cpp