Farbvorschau und Farbauswahl korrigiert
This commit is contained in:
@@ -17,30 +17,8 @@
|
|||||||
const QRegularExpression ColorIndicator::s_colorRegex(
|
const QRegularExpression ColorIndicator::s_colorRegex(
|
||||||
// #rgb / #rrggbb / #rrggbbaa
|
// #rgb / #rrggbb / #rrggbbaa
|
||||||
R"(#(?:[0-9A-Fa-f]{8}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})(?=[^0-9A-Fa-f]|$))"
|
R"(#(?:[0-9A-Fa-f]{8}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})(?=[^0-9A-Fa-f]|$))"
|
||||||
R"(|rgba?\s*\([^)]+\))" // rgb() / rgba()
|
R"(|rgba?\s*\([^)]+\))"
|
||||||
R"(|hsla?\s*\([^)]+\))" // hsl() / hsla()
|
R"(|hsla?\s*\([^)]+\))",
|
||||||
// Benannte Farben — nur als ganzes Wort
|
|
||||||
R"(|\b(?:aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|)"
|
|
||||||
R"(blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|)"
|
|
||||||
R"(chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|)"
|
|
||||||
R"(darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|)"
|
|
||||||
R"(darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|)"
|
|
||||||
R"(darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|)"
|
|
||||||
R"(deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|)"
|
|
||||||
R"(forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|)"
|
|
||||||
R"(greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|)"
|
|
||||||
R"(lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|)"
|
|
||||||
R"(lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|)"
|
|
||||||
R"(lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|)"
|
|
||||||
R"(lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|)"
|
|
||||||
R"(mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|)"
|
|
||||||
R"(mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|)"
|
|
||||||
R"(navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|)"
|
|
||||||
R"(palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|)"
|
|
||||||
R"(powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|)"
|
|
||||||
R"(sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|)"
|
|
||||||
R"(slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|)"
|
|
||||||
R"(violet|wheat|white|whitesmoke|yellow|yellowgreen)\b)",
|
|
||||||
QRegularExpression::CaseInsensitiveOption
|
QRegularExpression::CaseInsensitiveOption
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -293,7 +271,7 @@ QColor ColorIndicator::parseColor(const QString &token)
|
|||||||
if (t.startsWith("hsla", Qt::CaseInsensitive)) { return parseHsla(t); }
|
if (t.startsWith("hsla", Qt::CaseInsensitive)) { return parseHsla(t); }
|
||||||
if (t.startsWith("hsl", Qt::CaseInsensitive)) { return parseHsl(t); }
|
if (t.startsWith("hsl", Qt::CaseInsensitive)) { return parseHsl(t); }
|
||||||
|
|
||||||
return parseNamed(t);
|
return QColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor ColorIndicator::parseHex(const QString &s)
|
QColor ColorIndicator::parseHex(const QString &s)
|
||||||
@@ -379,9 +357,5 @@ QColor ColorIndicator::parseHsla(const QString &s)
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor ColorIndicator::parseNamed(const QString &s)
|
|
||||||
{
|
|
||||||
// QColor kennt alle 140 CSS-Farbnamen direkt
|
|
||||||
const QColor c(s.toLower());
|
|
||||||
return c.isValid() ? c : QColor();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ private:
|
|||||||
static QColor parseRgba(const QString &s);
|
static QColor parseRgba(const QString &s);
|
||||||
static QColor parseHsl(const QString &s);
|
static QColor parseHsl(const QString &s);
|
||||||
static QColor parseHsla(const QString &s);
|
static QColor parseHsla(const QString &s);
|
||||||
static QColor parseNamed(const QString &s);
|
|
||||||
|
|
||||||
CodeEditor *m_editor = nullptr;
|
CodeEditor *m_editor = nullptr;
|
||||||
QList<ColorMatch> m_cache;
|
QList<ColorMatch> m_cache;
|
||||||
|
|||||||
Reference in New Issue
Block a user