chrisbra / Colorizer

color hex codes and color names
550 stars 31 forks source link

taskwarrior theme-file highlight challenges #26

Closed linuxcaffe closed 11 years ago

linuxcaffe commented 11 years ago

Hi crisbra! so exited to find this plugin, as I've been looking for something to this effect, to help with creating and tweaking taskwarrior(.org) theme files.

I've pasted a sample file here: https://gist.github.com/linuxcaffe/7432128. Taskwarrior uses three types of color directives for themeing; rgb123, color27 and magenta, in a "fg on bg" arrangement.

I installed your fine plugin, added "let g:colorizer_x11_names = 1" to my vimrc, but so far I have only been able to scare up highlighting for "black" and "white" and I can already guess what those two are going to look like.

Should Colorizer be "good to go" for such a theme file? Can you give me any pointers to make it work? thanks

linuxcaffe commented 11 years ago

Here's a screenshot, with some limited success on a (almost) 16 color theme;

http://taskwarrior.org/issues/1428#note-3

for it to work properly for tw.themes,

color.due=on green  

is a bg-only directive

color.scheduled=yellow

is a fg-only directive, and

color.debug=white on red

is fg-on-bg

chrisbra commented 11 years ago

Hi, I am not sure I understand correctly. Currently colorizer only highlights colorcodes and color names. It's not able to parse the taskwarrior statements like (white on red) and color it correctly or even parse xterm color names like color0.

So do you want to have the line

color.scheduled=yellow

colored in a yellow background?

While

color.debug=white on red

would color the whole line white on a red background? or only the color statement? Or should the plugin somehow remember the color definition and use it elsewhere?

Or how should the plugin color it?

That sounds like a fun and interesting challenge ;)

linuxcaffe commented 11 years ago

I'm glad you're amused and interested! tw.themes are 256 color-capable, but the current set are.. (imho) a wee bit ugly, this tool would help a lot in creating the next-gen-themes!

I think the most complicating factors are

and

color.scheduled=yellow

I would want to see yellow fg text with no bg directive, and conversely

color.due=on green

causes a green bg with no fg directive

color.debug=white on red

should invoke white text on a red bg

These nasty separations of fg and bg directives, are actually important to allow more than a single factor to provide color-clues of the tasks current status.

chrisbra commented 11 years ago

But do you need it to color the complete line or only the match (e.g. color.debug=|white on red|) where | denotes what will be colored? Can there actually be a whitespace between the '='?

linuxcaffe commented 11 years ago

I think the match (including the spaces, if any) should be fine. The output of task command "task color legend" (as see on the left of the screenshot) colors the whole line, which would be fine too. (which ever way would be easiest)

chrisbra commented 11 years ago

Hi David!

On Di, 12 Nov 2013, David J Patrick wrote:

I think the match (including the spaces, if any) should be fine. The output of task command "task color legend" (as see on the left of the screenshot) colors the whole line, which would be fine too. (which ever way would be easiest)

I have added experimental taskwarrior support. Please make sure, to set in your .vimrc:

:let g:colorizer_taskwarrior_disable = 0

Please check, if it works as you would expect.

Best,

Christian

Was man besonders gerne tut, ist selten ganz besonders gut.

linuxcaffe commented 11 years ago

That's amazing Christian! I can't wait to try it! thanks, I'll let you know how it goes, and I can't wait to show the taskwarrior gang! djp

On 15 November 2013 17:57, chrisbra notifications@github.com wrote:

Hi David!

On Di, 12 Nov 2013, David J Patrick wrote:

I think the match (including the spaces, if any) should be fine. The output of task command "task color legend" (as see on the left of the screenshot) colors the whole line, which would be fine too. (which ever way would be easiest)

I have added experimental taskwarrior support. Please make sure, to set in your .vimrc:

:let g:colorizer_taskwarrior_disable = 0

Please check, if it works as you would expect.

Best,

Christian

Was man besonders gerne tut, ist selten ganz besonders gut.

— Reply to this email directly or view it on GitHubhttps://github.com/chrisbra/color_highlight/issues/26#issuecomment-28610535 .

linuxcaffe commented 11 years ago

Well I appreciate the extra attention to taskwarrior theme files, but perhaps I'm doing something wrong; the highlighting seems to have gotten slightly worse than before I asked you to have a look! :-) I followed the above instructions and pulled the post recent changes, and this is a current screenshot, as compared to to output of the "task color legend" command, on the right. The legend has it's own errors, but it would be the target for coloration.

http://taskwarrior.org/issues/1428#note-4

If you have a look at the screenshot on the tw discussion page, you'll see that highlighting bg and fg is still a bit wonky :) and the even-more-recent rendering is different again!

color_highlight-tw-legend_16 theme-2

I hope you're having fun.. I am! if at any point this seems futile, just say the word :) For fine-tuned 256 color themes, the plugin would be awesome, but only if it's "easy".

chrisbra commented 11 years ago

Hi David!

On Sa, 16 Nov 2013, David J Patrick wrote:

Well I appreciate the extra attention to taskwarrior theme files, but perhaps I'm doing something wrong; the highlighting seems to have gotten slightly worse than before I asked you to have a look! :-) I followed the above instructions and pulled the post recent changes, and this is a current screenshot, as compared to to output of the "task color legend" command, on the right. The legend has it's own errors, but it would be the target for coloration.

http://taskwarrior.org/issues/1428#note-4

Which side of that screenshot is used by the colorizer_highlight plugin?

If you have a look at the screenshot on the tw discussion page, you'll see that highlighting bg and fg is still a bit wonky :) and the even-more-recent rendering is different again!

color_highlight-tw-legend_16 theme-2

I hope you're having fun.. I am! if at any point this seems futile, just say the word :) For fine-tuned 256 color themes, the plugin would be awesome.

Hm, Can you check your &t_Co setting? I made a screen capture from within a 256 color terminal with the provided gist sample file.

You can see it here: www.256bit.org/~chrisbra/taskwarrior_20131116.mkv

Is that what you would expect?

Best, Christian

linuxcaffe commented 11 years ago

WOW! I WAS doing something wrong! I gave it another whirl, followed instructions and BAM! You have DONE IT sir! Perfect! Thanks, I'll alert the media ;-)

chrisbra commented 11 years ago

Hi David!

On Sa, 16 Nov 2013, David J Patrick wrote:

WOW! I WAS doing something wrong! I gave it another whirl, followed instructions and BAM! You have DONE IT sir! Perfect! Thanks, I'll alert the media ;-)

Glad you liked it ;)

BTW, do you need this only in a special filetype? (E.g. what is the filetype setting in a buffer, where you need to have the taskwarrior coloring? Or is there way to detect, whether a buffer needs this kind of coloring? I am thinking to get rid of the :let g:colorizer_taskwarrior_disable=0 step

Best,

Christian

linuxcaffe commented 11 years ago

On 17 November 2013 07:37, chrisbra notifications@github.com wrote:

Glad you liked it ;)

BTW, do you need this only in a special filetype? (E.g. what is the filetype setting in a buffer, where you need to have the taskwarrior coloring? Or is there way to detect, whether a buffer needs this kind of coloring?

Well the only place I can see this being used is on taskwarrior.theme files (*.theme) but I'm not sure where that is defined, Should be be adding ft=tw-theme or some other vim codes to the files, or something??

I am thinking to get rid of the :let g:colorizer_taskwarrior_disable=0 step

Whatever it takes Christian, thanks a lot! djp

linuxcaffe commented 11 years ago

Hi! subsequent testing has shown that this plugin is working brilliantly with "colorxxx" codes, but for rgbxxx codes, it seems to be "way off", it colorizes, but not the colors we might expect from this color-cube;

screenshot_tw_color

Also, the color-names for a 16 color palette, are not applying "color on color". Maybe this set of color-names is a different mode? (see sample dark-16 theme file https://gist.github.com/7517239)

linuxcaffe commented 11 years ago

I don't even know the proper name for it, but the line of vim-codes at the bottom of a file with ft=vim and all that.. can you suggest what a taskwarrior theme should have embedded, in order to help highlight the file and easily trigger the filetype? (by convention, they all end in ".theme") Maybe we (tw community) should develop a ../syntax/tasktheme.vim? (over my head)

thanks again Christian!

chrisbra commented 11 years ago

Hi David!

On So, 17 Nov 2013, David J Patrick wrote:

Hi! subsequent testing has shown that this plugin is working brilliantly with "colorxxx" codes, but for rgbxxx codes, it seems to be "way off", it colorizes, but not the colors we might expect from this color-cube;

Ah, I think, the rgb colors were slight off by 16, because the color terminal colors start at 16 and not at 0. I fixed it now.

screenshot_tw_color

Also, the color-names for a 16 color palette, are not applying "color on color". Maybe this set of color-names is a different mode? (see sample dark-16 theme file https://gist.github.com/7517239)

Ah, I see. the background color value has not been used, because it was given as color name. I have fixed that now.

Please let me know, if you find more issues.

Best,

Christian

Wenn wir bedenken, daß wir alle verrückt sind, ist das Leben erklärt. -- Mark Twain (eigl. Samuel Langhorne Clemens)

chrisbra commented 11 years ago

Hi David!

On So, 17 Nov 2013, David J Patrick wrote:

On 17 November 2013 07:37, chrisbra notifications@github.com wrote:

Glad you liked it ;)

BTW, do you need this only in a special filetype? (E.g. what is the filetype setting in a buffer, where you need to have the taskwarrior coloring? Or is there way to detect, whether a buffer needs this kind of coloring?

Well the only place I can see this being used is on taskwarrior.theme files (*.theme) but I'm not sure where that is defined, Should be be adding ft=tw-theme or some other vim codes to the files, or something??

Ok, I made it depend on the file extensions. So it will only try to color it this way, if the file ends with a .theme. This also means, that new buffers (that don't have a name yet) won't be colored.

Best,

Christian

Aller höherer Humor fängt damit an, daß man die eigene Person nicht mehr ernst nimmt. -- Hermann Hesse

linuxcaffe commented 11 years ago

You RULE Christian! The latest files almost everything, rgbxxx is behaving well, 16-colornames are "this on that" .. the only thing I can see that is not quite there is in the 16-color namespace, "on bright colorname" is "always on". In other words, there is no difference between "on green" and "on bright green" they are both "on bright".

but otherwise you sir deserve a medal! The future fabulous taskwarrior color themes should come with a little "thank you Christian" in the corner ;-)

chrisbra commented 11 years ago

Hi David!

On So, 17 Nov 2013, David J Patrick wrote:

I don't even know the proper name for it, but the line of vim-codes at the bottom of a file with ft-vim and all that.. can you suggest what a taskwarrior theme should have, in order to highlight the file and easily trigger the filetype? (by convention, they all end in ".theme") Maybe we (tw community) should develop a ../syntax/tasktheme.vim? (over my head)

Oh yes, you probably mean modelines (:h modeline)

The easiest would probably to either ship a file called ftdetect.vim containing a line like this:

au BufNewFile,BufRead /taskwarrior/.theme setf taskwarrior

That should set the filetype option for files, that live below a taskwarrior directory and end with .theme to 'taskwarrior' or whatever the filetype convention should be for taskwarrior theme files.

See also the faq at http://vimhelp.appspot.com/vim_faq.txt.html#faq-26.8 and look at examples in the file filetype.vim in Vims runtime directory.

Best,

Christian

Es ist besser, ein junger Maikäfer als ein alter Paradiesvogel zu sein. -- Mark Twain, Querkopf Wilsons Kalender

linuxcaffe commented 11 years ago

Thanks so much, yes of course.. "modelines" (I did the research after posting the dumb question) and I will suggest to the team that the ftdetect file, with the suggested line, be included with taskwarrior.

chrisbra commented 11 years ago

Hi David!

On Mo, 18 Nov 2013, David J Patrick wrote:

You RULE Christian! The latest files almost everything, rgbxxx is behaving well, 16-colornames are "this on that" .. the only thing I can see that is not quite there is in the 16-color namespace, "on bright colorname" is "always on". In other words, there is no difference between "on green" and "on bright green" they are both "on bright".

That is correct. I simply don't know how to make the background bright or bold. So that is currently simply ignored.

but otherwise you sir deserve a medal! The future fabulous taskwarrior color themes should come with a little "thank you Christian" in the corner ;-)

Thanks ;)

Best,

Christian

Erinnerungen sind Wirklichkeit im Sonntagsanzug. -- Oliver Hassencamp

linuxcaffe commented 11 years ago

works great for colorxxx and rgbxxx themes responding in real-time, here's a snapshot for anyone following this thread;

20131122_234152