mirror of
https://github.com/gabime/spdlog.git
synced 2025-04-30 04:23:51 +00:00
Qt Sink : Allow for darker colors (for light background). (#2817)
Default are too bright if background is light(white).
This commit is contained in:
parent
7e635fca68
commit
76dfc7e7c0
@ -71,7 +71,7 @@ template<typename Mutex>
|
|||||||
class qt_color_sink : public base_sink<Mutex>
|
class qt_color_sink : public base_sink<Mutex>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qt_color_sink(QTextEdit *qt_text_edit, int max_lines)
|
qt_color_sink(QTextEdit *qt_text_edit, int max_lines, bool dark_colors=false)
|
||||||
: qt_text_edit_(qt_text_edit)
|
: qt_text_edit_(qt_text_edit)
|
||||||
, max_lines_(max_lines)
|
, max_lines_(max_lines)
|
||||||
{
|
{
|
||||||
@ -84,16 +84,16 @@ public:
|
|||||||
// set colors
|
// set colors
|
||||||
QTextCharFormat format;
|
QTextCharFormat format;
|
||||||
// trace
|
// trace
|
||||||
format.setForeground(Qt::gray);
|
format.setForeground(dark_colors ? Qt::darkGray : Qt::gray);
|
||||||
colors_.at(level::trace) = format;
|
colors_.at(level::trace) = format;
|
||||||
// debug
|
// debug
|
||||||
format.setForeground(Qt::cyan);
|
format.setForeground(dark_colors ? Qt::darkCyan : Qt::cyan);
|
||||||
colors_.at(level::debug) = format;
|
colors_.at(level::debug) = format;
|
||||||
// info
|
// info
|
||||||
format.setForeground(Qt::green);
|
format.setForeground(dark_colors ? Qt::darkGreen : Qt::green);
|
||||||
colors_.at(level::info) = format;
|
colors_.at(level::info) = format;
|
||||||
// warn
|
// warn
|
||||||
format.setForeground(Qt::yellow);
|
format.setForeground(dark_colors ? Qt::darkYellow : Qt::yellow);
|
||||||
colors_.at(level::warn) = format;
|
colors_.at(level::warn) = format;
|
||||||
// err
|
// err
|
||||||
format.setForeground(Qt::red);
|
format.setForeground(Qt::red);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user