kdheepak / taskwarrior-tui

`taskwarrior-tui`: A terminal user interface for taskwarrior
https://kdheepak.com/taskwarrior-tui
MIT License
1.43k stars 68 forks source link

Wrong colors with Solarized Dark theme #68

Open desbma opened 3 years ago

desbma commented 3 years ago

I am using the Solarized Dark theme included with taskwarrior (include /usr/share/doc/task/rc/solarized-dark-256.theme in my .taskrc).

There are several differences in the color output between task and taskwarrior-tui:

If you can provide a dummy task list for testing, I'd be happy to post screenshots or help reproduce, but obviously I don't want to publish my task list.

Environment:

kdheepak commented 3 years ago

What terminal color scheme are you using in alacritty?

desbma commented 3 years ago

Here is my full config file: alacritty.txt

The part about colors:

colors:
  # Default colors
  primary:
    background: '0x002b36' # base03
    foreground: '0x839496' # base0

  # Cursor colors
  cursor:
    text:   '0x002b36' # base03
    cursor: '0x839496' # base0

  # Normal colors
  normal:
    black:   '0x073642' # base02
    red:     '0xdc322f' # red
    green:   '0x859900' # green
    yellow:  '0xb58900' # yellow
    blue:    '0x268bd2' # blue
    magenta: '0xd33682' # magenta
    cyan:    '0x2aa198' # cyan
    white:   '0xeee8d5' # base2

  # Bright colors
  bright:
    black:   '0x002b36' # base03
    red:     '0xcb4b16' # orange
    green:   '0x586e75' # base01
    yellow:  '0x657b83' # base00
    blue:    '0x839496' # base0
    magenta: '0x6c71c4' # violet
    cyan:    '0x93a1a1' # base1
    white:   '0xfdf6e3' # base3
kdheepak commented 3 years ago

Would you be able to share a screenshot of what it looks like in taskwarrior-tui and taskwarrior?

desbma commented 3 years ago

Here you go, with my anonymized task list, side by side: Selection_2021-02-09_21-20-57

As you can see, the colors are quite different.

kdheepak commented 3 years ago

Thanks! I'll look into this now.

kdheepak commented 3 years ago

I believe this is resolved now.

Screen Shot 2021-02-11 at 12 07 09 AM

all tasks below priority 8 (I'm not sure that is the differentiating factor) appear red/orange in taskwarrior-tui and grey/blue in task

What do you mean by priority 8? Do you mean urgency 8? I think this is also resolved. If you can test it that would be great!

kdheepak commented 3 years ago

Thanks for opening this issue! I'm surprised I never ran into this, maybe something else is broken in my configuration 😅. This bug fix is available in this release: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.9.15

desbma commented 3 years ago

Thanks, it's much better, but there are still many differences in the color rendering: Selection_2021-02-11_12-54-25

kdheepak commented 3 years ago

Can you tell me why those tasks are colored blue? Or if you can export your fake task list and share here and if I'm able to replicate it on my computer I'll be able to resolve this.

desbma commented 3 years ago

The blue tasks are the recurring ones (the parents, not the periodically generated instances) : https://github.com/GothenburgBitFactory/taskwarrior/blob/9017cd6e530e4dbb0aaabd66dd11f6e7e0b56aa4/doc/rc/solarized-dark-256.theme#L60

Sorry I can't export my task list, the screens above have been generated with my real task list, anonymized with a script to change tasks/projects/tags names, but an export includes the whole history.

I think however that generating a fake task list, with tasks in each possible state, and adding in in the repository could be of value for testing.

kdheepak commented 3 years ago

No worries, I understand about not exporting your task list.

I have a fake task list here: https://github.com/kdheepak/taskwarrior-testdata. If you'd like to submit a PR there that'd be great! Or feel free to share an version here, I can update it over there. I'll update the README.md to highlight it as well, so people can use that to submit a bug issue.

desbma commented 3 years ago

Recurring tasks now appear in blue, but I still have many tasks for example with virtual tags PENDING READY TAGGED UNBLOCKED YEAR that appear red in taskwarrior-tui and grey in task.

kdheepak commented 3 years ago

Yup, sorry, I meant to reopen this. I know the previous PR fixed just recurring colors.

If you can send me a fake task list that'll be ideal, and if I can replicate it I can make more progress on this. Right now I don't know what I'm missing and working through the taskwarrior codebase has not been fruitful.

Unfortunately, I think taskwarrior itself is not doing what it says it should be doing. See https://github.com/GothenburgBitFactory/taskwarrior/issues/2334. So there might be some cases where the colors differ.

desbma commented 3 years ago

Using test data from https://github.com/kdheepak/taskwarrior-testdata I managed to produce different colors by adding a due date for task 9, and making it depend on task 14 : Selection_2021-02-12_01-14-48

kdheepak commented 3 years ago

Hmm. Are you using the .taskrc that is in that repository? If not, can you share your .taskrc? I'm not getting that behavior with the .taskrc and .task folder in that repository.

desbma commented 3 years ago

Using .taskrc from the test repository: Selection_2021-02-12_21-13-05

kdheepak commented 3 years ago

Can you try the latest master again? I think I fixed this issue, but I have a feeling there's more corner cases with respect to the colors matching that of taskwarrior. I'll leave this issue open for now.

desbma commented 3 years ago

The colors are now similar to taskwarrior for almost every task in my list. :+1:

The only difference I see is a task (PENDING PRIORITY READY UDA UNBLOCKED with priority L) that appears green in the taskwarrior list, but I think this is a bug of taskwarrior because other tasks in the same state do not.

kdheepak commented 3 years ago

This should be resolved now, in a nice round number PR no less :) I'll make a new release. Feel free to open a new issue if any color issues occur again, I'm sure there is stuff I've missed.

kdheepak commented 3 years ago

You can now use this release: https://github.com/kdheepak/taskwarrior-tui/releases/tag/v0.10.0

desbma commented 3 years ago

Unfortunately, your last commit broke a few colors, some tasks (overdue or soon due with tag and project) are not colored anymore.

kdheepak commented 3 years ago

Oh dear. I really need to get tests up and running for all this. Thanks for letting me know, I'll look into it.

kdheepak commented 3 years ago

Was it working fine before the most recent PR?

desbma commented 3 years ago

It was working on b0faf77, yes.

desbma commented 3 years ago

I really need to get tests up and running for all this.

The best thing to do would be to add in the test repo a task in every possible combination of: tagged or not, has project or not, overdue or not, has due date or not, has wait date or not, blocked or not, blocking or not, recurring or not + every priority, and then have the tests checking the output for each task. But yeah that is is tedious work...

kdheepak commented 3 years ago

Yeah, I've started putting together tests. But it is good to know that it worked before the most recent PR. I might be able to reproduce it faster.

kdheepak commented 3 years ago

I put together a shorter list of tests:

uda.priority.values=U,H,M,L
urgency.uda.priority.U.coefficient=15.0
color.uda.priority.U=red
color.uda.priority.L=blue
color.uda.priority.M=yellow
color.uda.priority.H=green
color.project.wth=green on black
color.tagged=red on blue

I named a project wth and tagged other tasks. I'm fairly confident about this working as intended now. This is the screenshot of what taskwarrior-tui looks like and what taskwarrior looks like:

Screen Shot 2021-02-14 at 7 03 26 PM

There might still be a couple of corner cases with due tasks though. Those will not be with the coloring but with figuring out the correct internal tags for the tasks that taskwarrior uses, which in turn may affect the coloring. I'll have to iron those out later.

desbma commented 3 years ago

Thanks for your work and patience. :+1:

Still some color differences :

kdheepak commented 3 years ago

I think the reason OVERDUE DUETODAY tasks are being displayed incorrectly is that in taskwarrior the logic is not implemented the way I expect it to be implemented. I've opened an issue related to this and posted a comment for clarification.

https://github.com/GothenburgBitFactory/taskwarrior/issues/2334#issuecomment-779389283

If they suggest that it is to be implemented the way it is done in taskwarrior, I'll be able to special case that to conform to the taskwarrior spec. If it is a bug and they agree with my assessment, I'll submit a PR to taskwarrior, and leave this as is.

kdheepak commented 3 years ago

one pending task (PENDING PRIORITY READY UDA UNBLOCKED) appears blue in taskwarrior-tui, grey in taskwarrior. I have no idea why though. It may be a taskwarrior bug.

I'm not able to replicate this though.

If you are able to compile from source, can you try the following:

1) Checkout the latest master 2) Change this line to point to the task_id in question https://github.com/kdheepak/taskwarrior-tui/blob/4b92e6e9575ce622427876c9acb9e38eb616488d/src/app.rs#L1772 3) Add dbg!(task.tags().unwrap()); to the next line. 3) Run the following and share the output here.

   cargo test --package taskwarrior-tui --bin taskwarrior-tui -- app::tests::test_task_style --exact --nocapture

I mainly want to see the output of task.tags() so that I can figure out if there's a bug with the generation of the internal tags. You have some taskwarrior tags here it'll show up, feel free to anonymize those before sharing.

desbma commented 3 years ago

I also had to comment out the previous asserts.

[src/app.rs:1773] task.tags().unwrap() = [
    "PENDING",
    "PRIORITY",
]
[src/app.rs:1775] style = Style {
    fg: Some(
        LightBlue,
    ),
    bg: None,
    add_modifier: BOLD,
    sub_modifier: (empty),
}

EDIT : That output is for a task that appears grey in taskwarrior-tui and blue in taskwarrior.

kdheepak commented 3 years ago

Thanks, that's helpful.

kdheepak commented 3 years ago

I've redone all the colors and added more tests. Currently the only inconsistency I could find is for OVERDUE tasks. Let me know if you find anything else.

desbma commented 3 years ago

The only difference I see in the output is a task in blue in taskwarrior and grey in taskwarrior-tui, but I don't understand the rational for coloring it that way in taskwarrior, so I am fine with the current taskwarrior-tui behavior.

kdheepak commented 3 years ago

That is confirmed to be a bug and will be fixed in the next minor release for taskwarrior (2.6.0): https://github.com/GothenburgBitFactory/taskwarrior/issues/2334#issuecomment-780276402

adriangalilea commented 4 months ago

task:

image

taskwarrior-tui

image

Why does it show the blue color?

kdheepak commented 4 months ago

I’m not sure! I will reopen the issue.

adriangalilea commented 4 months ago

I think is related to scheduled tasks, I removed scheduled from one task and it stopped being blue.

kdheepak commented 4 months ago

Thanks for reporting!