util: Added helper function to properly manage table header color/underline
This commit is contained in:
29
src/util.cpp
29
src/util.cpp
@@ -303,3 +303,32 @@ const char* optionalBlankLine ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void setHeaderUnderline (Table& table)
|
||||||
|
{
|
||||||
|
// If an alternating row color is specified, notify the table.
|
||||||
|
if (context.color ())
|
||||||
|
{
|
||||||
|
Color alternate (context.config.get ("color.alternate"));
|
||||||
|
table.colorOdd (alternate);
|
||||||
|
table.intraColorOdd (alternate);
|
||||||
|
|
||||||
|
if (context.config.getBoolean ("fontunderline"))
|
||||||
|
{
|
||||||
|
table.colorHeader (Color ("underline " + context.config.get ("color.label")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
table.colorHeader (Color (context.config.get ("color.label")));
|
||||||
|
table.underlineHeaders ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (context.config.getBoolean ("fontunderline"))
|
||||||
|
table.colorHeader (Color ("underline"));
|
||||||
|
else
|
||||||
|
table.underlineHeaders ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
#endif
|
#endif
|
||||||
#include <Task.h>
|
#include <Table.h>
|
||||||
|
|
||||||
// util.cpp
|
// util.cpp
|
||||||
int confirm4 (const std::string&);
|
int confirm4 (const std::string&);
|
||||||
@@ -63,6 +63,7 @@ const std::vector <std::string> extractParents (
|
|||||||
bool nontrivial (const std::string&);
|
bool nontrivial (const std::string&);
|
||||||
int strippedLength (const std::string&);
|
int strippedLength (const std::string&);
|
||||||
const char* optionalBlankLine ();
|
const char* optionalBlankLine ();
|
||||||
|
void setHeaderUnderline (Table&);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user