GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.49k stars 309 forks source link

Add configurable color settings for the Net column in the history report #3690

Open d2718nis opened 5 days ago

d2718nis commented 5 days ago

Current Behavior

Currently, the Net column in the history report uses hardcoded red and green colors to indicate negative and positive values, respectively.

Problem

For *-256.theme themes, which are intended to work independently of terminal themes, these hardcoded values depend on the terminal's configuration. This can result in colors that may not match the intended design of the theme, leading to inconsistencies or poor readability.

Proposed Solution

Introduce two new color settings:

color.history.net.positive=red
color.history.net.negative=green

Modify the code to use these settings:

Color net_color;
if (Context::getContext().color() && net) {
    net_color = (net > 0) 
        ? Color(Context::getContext().config.get("color.history.net.positive"))
        : Color(Context::getContext().config.get("color.history.net.negative"));
}

view.set(row, HistoryStrategy::dateFieldCount + 3, net, net_color);

These settings should probably default to red and green, maintaining the current behavior, while allowing theme developers to redefine them.

Additional Notes