summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Bootstrap.cxx19
-rw-r--r--Bootstrap.hxx5
2 files changed, 23 insertions, 1 deletions
diff --git a/Bootstrap.cxx b/Bootstrap.cxx
index 994ed84..c0d2fb9 100644
--- a/Bootstrap.cxx
+++ b/Bootstrap.cxx
@@ -8,7 +8,9 @@ Bootstrap::Bootstrap(QObject *parent):
bsLightBodyColor("#212529"),
bsDarkBodyColor("#adb5bd"),
bsLightBodyBg("#fff"),
- bsDarkBodyBg("#212529")
+ bsDarkBodyBg("#212529"),
+ bsLightBorderColor("#dee2e6"),
+ bsDarkBorderColor("#495057")
{
QFile conf{QStringLiteral(":/qtquickcontrols2.conf")};
if (!conf.open(QIODevice::ReadOnly | QIODevice::Text)) return;
@@ -39,6 +41,15 @@ Bootstrap::Bootstrap(QObject *parent):
bsDarkBodyBg = QColor{darkBodyBg};
free(darkBodyBg);
}
+ auto borderColor = toml_array_in(bootstrap, "BorderColor");
+ if (borderColor) {
+ auto lightBorderColor = toml_string_at(borderColor, 0).u.s;
+ bsLightBorderColor = QColor{lightBorderColor};
+ free(lightBorderColor);
+ auto darkBorderColor = toml_string_at(borderColor, 1).u.s;
+ bsDarkBorderColor = QColor{darkBorderColor};
+ free(darkBorderColor);
+ }
toml_free(toml);
}
@@ -59,6 +70,7 @@ void Bootstrap::setDarkMode(bool darkMode)
emit darkModeChanged();
emit bodyColorChanged();
emit bodyBgChanged();
+ emit borderColorChanged();
}
Bootstrap::Theme Bootstrap::theme() const
@@ -82,3 +94,8 @@ QColor Bootstrap::bodyBg() const
{
return bsDarkMode ? bsDarkBodyBg : bsLightBodyBg;
}
+
+QColor Bootstrap::borderColor() const
+{
+ return bsDarkMode ? bsDarkBorderColor : bsLightBorderColor;
+}
diff --git a/Bootstrap.hxx b/Bootstrap.hxx
index 7d993c2..57fa3aa 100644
--- a/Bootstrap.hxx
+++ b/Bootstrap.hxx
@@ -17,6 +17,7 @@ class Bootstrap : public QObject
Q_PROPERTY(bool darkMode READ darkMode WRITE setDarkMode NOTIFY darkModeChanged)
Q_PROPERTY(QColor bodyColor READ bodyColor NOTIFY bodyColorChanged)
Q_PROPERTY(QColor bodyBg READ bodyBg NOTIFY bodyBgChanged)
+ Q_PROPERTY(QColor borderColor READ borderColor NOTIFY borderColorChanged)
QML_ELEMENT
QML_UNCREATABLE("Bootstrap is an attached property")
@@ -43,12 +44,14 @@ class Bootstrap : public QObject
void setDarkMode(bool darkMode);
QColor bodyColor() const;
QColor bodyBg() const;
+ QColor borderColor() const;
signals:
void themeChanged();
void darkModeChanged();
void bodyColorChanged();
void bodyBgChanged();
+ void borderColorChanged();
private:
Theme bsTheme;
@@ -57,6 +60,8 @@ class Bootstrap : public QObject
QColor bsDarkBodyColor;
QColor bsLightBodyBg;
QColor bsDarkBodyBg;
+ QColor bsLightBorderColor;
+ QColor bsDarkBorderColor;
};
QML_DECLARE_TYPEINFO(Bootstrap, QML_HAS_ATTACHED_PROPERTIES)