Skip to content

Commit

Permalink
Merge pull request #1552 from contour-terminal/fix/default-color-conf…
Browse files Browse the repository at this point in the history
…ig-loading

[contour] Config: Fix default foreground color loading (was not read anymore)
  • Loading branch information
christianparpart authored Jul 1, 2024
2 parents 678bc62 + 421024b commit 2a7014a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/contour/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ void YAMLConfigReader::loadFromEntry(YAML::Node const& node,

if (!child) // can not load directly from config file
{

logger()(
"color paletter not found inside config file, checking colorschemes directory for {}.yml file",
entry);
Expand Down Expand Up @@ -491,6 +490,8 @@ void YAMLConfigReader::loadFromEntry(YAML::Node const& node, vtbackend::ColorPal
logger()("*** loading default colors");
loadFromEntry(child["default"], "background", where.defaultBackground);
loadFromEntry(child["default"], "foreground", where.defaultForeground);
loadFromEntry(child["default"], "bright_foreground", where.defaultForegroundBright);
loadFromEntry(child["default"], "dimmed_foreground", where.defaultForegroundDimmed);
}

if (child["background_image"] && child["background_image"]["path"]) // ensure that path exist
Expand Down Expand Up @@ -2081,8 +2082,11 @@ std::string createString(Config const& c)
fmt::arg("comment", "#")));
{
const auto _ = typename Writer::Offset {};
processWithDoc(
documentation::DefaultColors, entry.defaultBackground, entry.defaultForeground);
processWithDoc(documentation::DefaultColors,
entry.defaultBackground,
entry.defaultForeground,
entry.defaultForegroundBright,
entry.defaultForegroundDimmed);

// processWithDoc("# Background image support.\n"
// "background_image:\n"
Expand Down
20 changes: 13 additions & 7 deletions src/contour/ConfigDocumentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,13 +816,19 @@ constexpr StringLiteral ExperimentalFeatures {
"{comment} feature_xyz: true\n"
};

constexpr StringLiteral DefaultColors { "{comment} Default colors\n"
"default:\n"
" {comment} Default background color (this can be made "
"transparent, see above).\n"
" background: {}\n"
" {comment} Default foreground text color.\n"
" foreground: {}\n" };
constexpr StringLiteral DefaultColors {
"{comment} Default colors\n"
"default:\n"
" {comment} Default background color (this can be made "
"transparent, see above).\n"
" background: {}\n"
" {comment} Default foreground text color.\n"
" foreground: {}\n"
" {comment} Default foreground text color when bold(/bright) mode is on.\n"
" bright_foreground: {}\n"
" {comment} Default foreground text color when dim mode is on.\n"
" dimmed_foreground: {}\n"
};

constexpr StringLiteral HyperlinkDecoration {
"\n"
Expand Down

0 comments on commit 2a7014a

Please sign in to comment.