From 25871cd5d5d5e9eeed7ae81bf31c1b9bfacdf9c5 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Tue, 14 Nov 2023 23:30:28 +0100 Subject: [PATCH] Print: Make strings brightgreen color --- src/printer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/printer.cpp b/src/printer.cpp index 742afdf..48e7271 100644 --- a/src/printer.cpp +++ b/src/printer.cpp @@ -8,12 +8,14 @@ #include // std::static_pointer_cast #include +#include "ruc/format/color.h" #include "ruc/format/format.h" #include "ast.h" #include "error.h" #include "lexer.h" #include "printer.h" +#include "settings.h" #include "types.h" #include "util.h" @@ -64,6 +66,8 @@ void Printer::init() void Printer::printImpl(ValuePtr node, bool print_readably) { + bool pretty_print = Settings::the().get("pretty-print") == "1"; + auto printSpacing = [this]() -> void { if (!m_first_node && !m_previous_node_is_list) { m_print += ' '; @@ -109,7 +113,12 @@ void Printer::printImpl(ValuePtr node, bool print_readably) text = "\"" + text + "\""; } printSpacing(); - m_print += ::format("{}", text); + if (pretty_print) { + m_print += ::format(fg(ruc::format::TerminalColor::BrightGreen), "{}", text); + } + else { + m_print += ::format("{}", text); + } } else if (is(node_raw_ptr)) { printSpacing();