Skip to content

Commit

Permalink
Introduce themed iconAccentColor (#ff00ff)
Browse files Browse the repository at this point in the history
  • Loading branch information
kislinsk committed Nov 20, 2017
1 parent dfa2b0c commit 3e99346
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Plugins/org.blueberry.ui.qt/resources/darkstyle.qss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ See LICENSE.txt or http://www.mitk.org for details.
/*
foregroundColor = #adb1b6
iconColor = #adb1b6 <- This line is parsed by MITK
iconAccentColor = #db7039 <- This line is parsed by MITK
backgroundColor = #323231
inactiveColor = #1d1d1c
highlightColor = #3399cc
Expand Down
5 changes: 5 additions & 0 deletions Plugins/org.blueberry.ui.qt/resources/defaultstyle.qss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
iconColor = #000000 <- This line is parsed by MITK
iconAccentColor = #000000 <- This line is parsed by MITK
*/

berry--QCTabBar::tab {
background: palette(window);
min-height: 24px;
Expand Down
8 changes: 8 additions & 0 deletions Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,15 @@ QByteArray AbstractUICTKPlugin::ApplyTheme(const QByteArray &originalSVG)
? match.captured(1)
: QStringLiteral("#000000");

re.setPattern(QStringLiteral("iconAccentColor\\s*[=:]\\s*(#[0-9a-f]{6})"));
match = re.match(styleSheet);

auto iconAccentColor = match.hasMatch()
? match.captured(1)
: QStringLiteral("#000000");

auto themedSVG = QString(originalSVG).replace(QStringLiteral("#00ff00"), iconColor, Qt::CaseInsensitive);
themedSVG = themedSVG.replace(QStringLiteral("#ff00ff"), iconAccentColor, Qt::CaseInsensitive);

return themedSVG.toLatin1();
}
Expand Down

0 comments on commit 3e99346

Please sign in to comment.