An inline comment after a colour value in colors.toml makes the window render
entirely black. Inline comments are legal TOML.
Versions: omacalc 0.2.2-1, omawrite 0.5.0-1, Omarchy 4.0.1
Repro
mode = "dark"
background = "#191724" # base
foreground = "#e0def4" # text
Apply the theme, launch the app, window is black.
Cause
Backend::loadOmarchyTheme (src/backend.cpp:457) strips quotes only when the
value both starts and ends with one. With a trailing comment it no longer ends
in a quote, so the quotes stay on and the comment comes with them:
background = "#191724" # base -> ["#191724" # base]
QColor rejects that and Qt paints an invalid colour black. Background and
foreground both go black, so the window does. mode usually has no trailing
comment, so dark mode is still detected correctly, which makes it look like a
rendering bug rather than a parsing one.
No stock theme puts a comment after a value, and loadsCurrentOmarchyTheme
writes a comment-free palette, which is why this hasn't come up.
Fix
QString value = line.mid(equals + 1).trimmed();
if (!value.isEmpty()
&& (value.front() == QLatin1Char('"') || value.front() == QLatin1Char('\''))) {
const QChar quote = value.front();
const int close = value.indexOf(quote, 1);
if (close > 0)
value = value.mid(1, close - 1);
} else {
// A comment marker is preceded by whitespace; an unquoted #rrggbb is not.
for (int i = 1; i < value.size(); ++i) {
if (value.at(i) == QLatin1Char('#') && value.at(i - 1).isSpace()) {
value = value.left(i).trimmed();
break;
}
}
}
Truncating at the first # does not work, hex colours start with one.
Built against Backend: fixes the repro, handles single quotes and bare
values, and all 22 stock themes parse identically to before.
The same parser and the same bug are in omawrite (src/backend.cpp:598).
An inline comment after a colour value in
colors.tomlmakes the window renderentirely black. Inline comments are legal TOML.
Versions: omacalc 0.2.2-1, omawrite 0.5.0-1, Omarchy 4.0.1
Repro
Apply the theme, launch the app, window is black.
Cause
Backend::loadOmarchyTheme(src/backend.cpp:457) strips quotes only when thevalue both starts and ends with one. With a trailing comment it no longer ends
in a quote, so the quotes stay on and the comment comes with them:
QColorrejects that and Qt paints an invalid colour black. Background andforeground both go black, so the window does.
modeusually has no trailingcomment, so dark mode is still detected correctly, which makes it look like a
rendering bug rather than a parsing one.
No stock theme puts a comment after a value, and
loadsCurrentOmarchyThemewrites a comment-free palette, which is why this hasn't come up.
Fix
Truncating at the first
#does not work, hex colours start with one.Built against
Backend: fixes the repro, handles single quotes and barevalues, and all 22 stock themes parse identically to before.
The same parser and the same bug are in omawrite (
src/backend.cpp:598).