Skip to content

Commit

Permalink
Fix RGBA values (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
falbru authored Dec 21, 2024
1 parent 0b15032 commit fc72cad
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/rpc/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,17 @@ QColor Color::toQColor(const ColorPalette &color_palette, const QColor &fallback
return Qt::white;
}

QString hexCode = color.mid(color.indexOf(":") + 1);
int separatorIndex = color.indexOf(":");
QString colorFormat = color.mid(0, separatorIndex);
QString hexCode = color.mid(separatorIndex + 1);

if (colorFormat == "rgba")
{
QString rgbValue = hexCode.mid(0, 6);
QString alphaValue = hexCode.mid(6);
hexCode = alphaValue + rgbValue;
}

return QColor("#" + hexCode);
}
} // namespace RPC

0 comments on commit fc72cad

Please sign in to comment.