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, QStringcolorNames () 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

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.

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

Returns the map of color names.

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.
void IrcPalette::setColorNames ( const QMap< int, QString > &  names)

Sets the map of color names.

Property Documentation

QString IrcPalette::black
readwrite

This property holds the black color name.

The default value is "black".

Access functions:
See also
Irc::Black
QString IrcPalette::blue
readwrite

This property holds the blue color name.

The default value is "blue".

Access functions:
See also
Irc::Blue
QString IrcPalette::brown
readwrite

This property holds the brown color name.

The default value is "brown".

Access functions:
See also
Irc::Brown
QString IrcPalette::cyan
readwrite

This property holds the cyan color name.

The default value is "cyan".

Access functions:
See also
Irc::Cyan
QString IrcPalette::gray
readwrite

This property holds the gray color name.

The default value is "gray".

Access functions:
See also
Irc::Gray
QString IrcPalette::green
readwrite

This property holds the green color name.

The default value is "green".

Access functions:
See also
Irc::Green
QString IrcPalette::lightBlue
readwrite

This property holds the light blue color name.

The default value is "lightblue".

Access functions:
See also
Irc::LightBlue
QString IrcPalette::lightCyan
readwrite

This property holds the light cyan color name.

The default value is "lightcyan".

Access functions:
See also
Irc::LightCyan
QString IrcPalette::lightGray
readwrite

This property holds the light gray color name.

The default value is "lightgray".

Access functions:
See also
Irc::LightGray
QString IrcPalette::lightGreen
readwrite

This property holds the light green color name.

The default value is "lightgreen".

Access functions:
See also
Irc::LightGreen
QString IrcPalette::orange
readwrite

This property holds the orange color name.

The default value is "orange".

Access functions:
See also
Irc::Orange
QString IrcPalette::pink
readwrite

This property holds the pink color name.

The default value is "pink".

Access functions:
See also
Irc::Pink
QString IrcPalette::purple
readwrite

This property holds the purple color name.

The default value is "purple".

Access functions:
See also
Irc::Purple
QString IrcPalette::red
readwrite

This property holds the red color name.

The default value is "red".

Access functions:
See also
Irc::Red
QString IrcPalette::white
readwrite

This property holds the white color name.

The default value is "white".

Access functions:
See also
Irc::White
QString IrcPalette::yellow
readwrite

This property holds the yellow color name.

The default value is "yellow".

Access functions:
See also
Irc::Yellow