GothenburgBitFactory / GothenburgBitFactory/taskwarrior
Add configurable color settings for the Net column in the history report
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 423
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 11
Description
## Current Behavior
[Currently](https://github.com/GothenburgBitFactory/taskwarrior/blob/98204b17a6b431ba660a6f1d9f21faf65a390d09/src/commands/CmdHistory.cpp#L218), 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:
```ini
color.history.net.positive=red
color.history.net.negative=green
```
Modify the code to use these settings:
```cpp
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
- Add these settings to the default theme configuration generated [here](https://github.com/GothenburgBitFactory/taskwarrior/blob/0ff78447322a10e24c18b4ce2950745cf17962a1/src/Context.cpp#L254)
- Update [taskrc](https://github.com/GothenburgBitFactory/taskwarrior/blob/develop/doc/man/taskrc.5.in#L1012) man page
- The use of color for the **Net** column is briefly mentioned in [this comment](https://github.com/GothenburgBitFactory/taskwarrior/issues/273#issuecomment-365073591)
Contributor guide
Assessment
This issue has not been assessed yet.