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

Specifies a palette of IRC colors. More...

Inherits QObject.

Public Member Functions

QString colorName (int color, const QString &fallback=QLatin1String("black")) const
 
QMap< int, QString > colorNames () const
 
void setColorName (int color, const QString &name)
 
void setColorNames (const QMap< int, QString > &names)
 

Properties

QString black
 
QString blue
 
QString brown
 
QString cyan
 
QString gray
 
QString green
 
QString lightBlue
 
QString lightCyan
 
QString lightGray
 
QString lightGreen
 
QString orange
 
QString pink
 
QString purple
 
QString red
 
QString white
 
QString yellow
 

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);
See also
Irc::Color, mIRC colors, SVG color keyword names

Member Function Documentation

◆ colorName()

QString IrcPalette::colorName ( int  color,
const QString &  fallback = QLatin1String("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.

◆ 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.

Property Documentation

◆ black

QString IrcPalette::black
readwrite

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
readwrite

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
readwrite

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

◆ cyan

QString IrcPalette::cyan
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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

◆ white

QString IrcPalette::white
readwrite

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
readwrite

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