Communi  3.7.0
A cross-platform IRC framework written with Qt
Public Member Functions | List of all members
IrcPalette Class Reference

Specifies a palette of IRC colors. More...

Inherits QObject.

Public Member Functions

QString black () const
 
QString blue () const
 
QString brown () const
 
QString colorName (int color, const QString &fallback=QStringLiteral("black")) const
 
QMap< int, QString > colorNames () const
 
QString cyan () const
 
QString gray () const
 
QString green () const
 
QString lightBlue () const
 
QString lightCyan () const
 
QString lightGray () const
 
QString lightGreen () const
 
QString orange () const
 
QString pink () const
 
QString purple () const
 
QString red () const
 
void setColorName (int color, const QString &name)
 
void setColorNames (const QMap< int, QString > &names)
 
QString white () const
 
QString yellow () const
 

Detailed Description

IrcPalette is used to specify the desired IRC color palette when converting IRC-style formatted messages to HTML using IrcTextFormat.

IrcPalette* palette = format.palette();
palette->setColorName(Irc::Red, "#ff3333");
palette->setColorName(Irc::Green, "#33ff33");
palette->setColorName(Irc::Blue, "#3333ff");
// ...
QString html = format.toHtml(message);
Specifies a palette of IRC colors.
Definition: ircpalette.h:44
void setColorName(int color, const QString &name)
Definition: ircpalette.cpp:519
Provides methods for text formatting.
Definition: irctextformat.h:46
Q_INVOKABLE QString toHtml(const QString &text) const
Definition: irctextformat.cpp:446
@ Red
The default value is "red".
Definition: irc.h:64
@ Blue
The default value is "blue".
Definition: irc.h:62
@ Green
The default value is "green".
Definition: irc.h:63
See also
Irc::Color, mIRC colors, SVG color keyword names

Member Function Documentation

◆ black()

QString IrcPalette::black ( ) const

This property holds the black color name.

The default value is "black".

Access functions:
  • QString black() const
  • void setBlack(const QString& color)
See also
Irc::Black

◆ blue()

QString IrcPalette::blue ( ) const

This property holds the blue color name.

The default value is "blue".

Access functions:
  • QString blue() const
  • void setBlue(const QString& color)
See also
Irc::Blue

◆ brown()

QString IrcPalette::brown ( ) const

This property holds the brown color name.

The default value is "brown".

Access functions:
  • QString brown() const
  • void setBrown(const QString& color)
See also
Irc::Brown

◆ colorName()

QString IrcPalette::colorName ( int  color,
const QString &  fallback = QStringLiteral("black") 
) const

Converts a color code to a color name. If the color code is unknown, the function returns the fallback color name.

◆ colorNames()

QMap< int, QString > IrcPalette::colorNames ( ) const

Returns the map of color names.

◆ cyan()

QString IrcPalette::cyan ( ) const

This property holds the cyan color name.

The default value is "cyan".

Access functions:
  • QString cyan() const
  • void setCyan(const QString& color)
See also
Irc::Cyan

◆ gray()

QString IrcPalette::gray ( ) const

This property holds the gray color name.

The default value is "gray".

Access functions:
  • QString gray() const
  • void setGray(const QString& color)
See also
Irc::Gray

◆ green()

QString IrcPalette::green ( ) const

This property holds the green color name.

The default value is "green".

Access functions:
  • QString green() const
  • void setGreen(const QString& color)
See also
Irc::Green

◆ lightBlue()

QString IrcPalette::lightBlue ( ) const

This property holds the light blue color name.

The default value is "lightblue".

Access functions:
  • QString lightBlue() const
  • void setLightBlue(const QString& color)
See also
Irc::LightBlue

◆ lightCyan()

QString IrcPalette::lightCyan ( ) const

This property holds the light cyan color name.

The default value is "lightcyan".

Access functions:
  • QString lightCyan() const
  • void setLightCyan(const QString& color)
See also
Irc::LightCyan

◆ lightGray()

QString IrcPalette::lightGray ( ) const

This property holds the light gray color name.

The default value is "lightgray".

Access functions:
  • QString lightGray() const
  • void setLightGray(const QString& color)
See also
Irc::LightGray

◆ lightGreen()

QString IrcPalette::lightGreen ( ) const

This property holds the light green color name.

The default value is "lightgreen".

Access functions:
  • QString lightGreen() const
  • void setLightGreen(const QString& color)
See also
Irc::LightGreen

◆ orange()

QString IrcPalette::orange ( ) const

This property holds the orange color name.

The default value is "orange".

Access functions:
  • QString orange() const
  • void setOrange(const QString& color)
See also
Irc::Orange

◆ pink()

QString IrcPalette::pink ( ) const

This property holds the pink color name.

The default value is "pink".

Access functions:
  • QString pink() const
  • void setPink(const QString& color)
See also
Irc::Pink

◆ purple()

QString IrcPalette::purple ( ) const

This property holds the purple color name.

The default value is "purple".

Access functions:
  • QString purple() const
  • void setPurple(const QString& color)
See also
Irc::Purple

◆ red()

QString IrcPalette::red ( ) const

This property holds the red color name.

The default value is "red".

Access functions:
  • QString red() const
  • void setRed(const QString& color)
See also
Irc::Red

◆ setColorName()

void IrcPalette::setColorName ( int  color,
const QString &  name 
)

Assigns a name for color code.

The color name may be in one of these formats:

  • #RGB (each of R, G, and B is a single hex digit)
  • #RRGGBB
  • #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.

◆ setColorNames()

void IrcPalette::setColorNames ( const QMap< int, QString > &  names)

Sets the map of color names.

◆ white()

QString IrcPalette::white ( ) const

This property holds the white color name.

The default value is "white".

Access functions:
  • QString white() const
  • void setWhite(const QString& color)
See also
Irc::White

◆ yellow()

QString IrcPalette::yellow ( ) const

This property holds the yellow color name.

The default value is "yellow".

Access functions:
  • QString yellow() const
  • void setYellow(const QString& color)
See also
Irc::Yellow