Issues #72, #110 Add label and text color settings in XP config GUI

This commit is contained in:
Mat Sutcliffe
2021-07-29 20:07:24 +01:00
parent 9bfcf13ef8
commit 33cb5827a6
4 changed files with 136 additions and 17 deletions

View File

@@ -132,6 +132,17 @@ namespace BlackMisc
return withHash ? u'#' % h : h;
}
int CRgbColor::packed() const
{
if (!isValid()) { return 0; }
return static_cast<int>(toQColor().rgb() & qRgba(255, 255, 255, 0));
}
CRgbColor CRgbColor::fromPacked(int rgb)
{
return { qRed(rgb), qGreen(rgb), qBlue(rgb) };
}
void CRgbColor::setByString(const QString &color, bool isName)
{
if (color.isEmpty()) { return; }

View File

@@ -86,6 +86,12 @@ namespace BlackMisc
//! Hex value
QString hex(bool withHash = false) const;
//! Value packed in 24 bit integer
int packed() const;
//! Construct from packed 24 bit integer value
static CRgbColor fromPacked(int rgb);
//! Hex or color name
void setByString(const QString &color, bool isName = false);