Communi  3.0.0
A cross-platform IRC framework written with Qt
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Macros Groups Pages
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