From 9bf8fcc8237416d487f1a9d10db010a9f2d4b2b3 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 28 Jan 2022 10:37:38 +0100 Subject: [PATCH] fix color.cpp formatting --- src/color.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/color.cpp b/src/color.cpp index 925b35c05..6142ff66c 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -47,14 +47,22 @@ std::string color::to_string() const boost::spirit::karma::uint_generator color_; std::string str; std::back_insert_iterator sink(str); - karma::generate(sink, - eps(alpha() < 255) - // begin grammar - << "rgba(" << color_(red()) << ',' << color_(green()) << ',' << color_(blue()) << ',' - << double_(alpha() / 255.0) << ')' | - "rgb(" << color_(red()) << ',' << color_(green()) << ',' << color_(blue()) << ')' + // clang-format off + karma::generate(sink, eps(alpha() < 255) + // begin grammar + << "rgba(" + << color_(red()) << ',' + << color_(green()) << ',' + << color_(blue()) << ',' + << double_(alpha() / 255.0) << ')' + | + "rgb(" + << color_(red()) << ',' + << color_(green()) << ',' + << color_(blue()) << ')' // end grammar ); + // clang-format on return str; } @@ -66,12 +74,17 @@ std::string color::to_hex_string() const boost::spirit::karma::right_align_type right_align; std::string str; std::back_insert_iterator sink(str); + // clang-format off karma::generate(sink, // begin grammar - '#' << right_align(2, '0')[hex(red())] << right_align(2, '0')[hex(green())] - << right_align(2, '0')[hex(blue())] << eps(alpha() < 255) << right_align(2, '0')[hex(alpha())] + '#' + << right_align(2,'0')[hex(red())] + << right_align(2,'0')[hex(green())] + << right_align(2,'0')[hex(blue())] + << eps(alpha() < 255) << right_align(2,'0')[hex(alpha())] // end grammar ); + // clang-format on return str; }