- Qt 6.8
- Qt GUI
- C++ Classes
- QColor
- Qt 6.8.3 Reference Documentation

# Obsolete Members for QColor

The following members of class QColor are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated in 6.6)` void | setNamedColor(const QString &name)
`(deprecated in 6.6)` void | setNamedColor(QLatin1StringView name)
`(deprecated in 6.6)` void | setNamedColor(QStringView name)

## Static Public Members

`(deprecated in 6.6)` bool | isValidColor(const QString &name)
`(deprecated in 6.6)` bool | isValidColor(QLatin1StringView name)
`(deprecated in 6.6)` bool | isValidColor(QStringView name)

## Member Function Documentation

### `[static, deprecated in 6.6]` bool QColor::isValidColor(const QString &name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use isValidColorName() instead.

Returns `true` if the name is a valid color name and can be used to construct a valid QColor object, otherwise returns false.

It uses the same algorithm used in setNamedColor().

See also setNamedColor().

### `[static noexcept, deprecated in 6.6]` bool QColor::isValidColor(QLatin1StringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use isValidColorName() instead.

### `[static noexcept, deprecated in 6.6]` bool QColor::isValidColor(QStringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use isValidColorName() instead.

### `[deprecated in 6.6]` void QColor::setNamedColor(const QString &name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

Use fromString() instead.

Sets the RGB value of this QColor to name, which may be in one of these formats:

- #RGB (each of R, G, and B is a single hex digit)
- #RRGGBB
- #AARRGGBB (Since 5.2)
- #RRRGGGBBB
- #RRRRGGGGBBBB
- A name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". These color names work on all platforms. Note that these color names are not the same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not refer to the same color.
- `transparent` - representing the absence of a color.

The color is invalid if name cannot be parsed.

See also QColor(), name(), and isValid().

### `[deprecated in 6.6]` void QColor::setNamedColor(QLatin1StringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use fromString() instead.

### `[deprecated in 6.6]` void QColor::setNamedColor(QStringView name)

This function is deprecated since 6.6. We strongly advise against using it in new code.

This is an overloaded function.

Use fromString() instead.