- if (style.contains("color:#")) { // we have either foreground or background color or both
- int posColors = 0;
- QString mircFgColor, mircBgColor;
- while ((posColors = regexColors.indexIn(style, posColors)) != -1) {
- QString colorType = regexColors.cap(1);
- QString color = regexColors.cap(2);
-
- if (colorType == "color")
- mircFgColor = _mircColorMap.key(color);
-
- if (colorType == "background-color")
- mircBgColor = _mircColorMap.key(color);
-
- posColors += regexColors.matchedLength();
- }
- if (!mircBgColor.isEmpty())
- content.prepend("," + mircBgColor);
-
- // we need a fg color to be able to use a bg color
- if (mircFgColor.isEmpty()) {
- //FIXME try to use the current forecolor
- mircFgColor = _mircColorMap.key(textColor().name());
- if (mircFgColor.isEmpty())
- mircFgColor = "01"; //use black if the current foreground color can't be converted
- }
-
- content.prepend(mircFgColor);
- content.prepend('\x03');
- content.append('\x03');