bastibe / annotate.el

Annotate.el
Other
384 stars 20 forks source link

how to loop color face when creating annotate? #147

Closed emacs25 closed 1 year ago

emacs25 commented 1 year ago

great package which helps me a lot to read book with thinking.
i want more colors to show so i add annotation- highlight-third....and annotate-annotation-thir d...and so on.

please tell me how to modify "annotate--annotat ion-builder" to enable them?

emacs25 commented 1 year ago

by the way,is it possible to adjust emacs theme with both light and dark?

cage2 commented 1 year ago

Hi @emacs25 !

The number of colors for the annotation is deeply ingrained in the code, unfortunately. Your proposed changes needs a lot of work and to be honest i do not know when i am going to find spare time to work on this improvements. If you want to file a patch i can support you writing it, if help is needed. Otherwise we have to wait that I finish working on the issue's backlog (and not only for this project!). The idea is nice, though! :smile_cat:

Bye! C.

cage2 commented 1 year ago

by the way,is it possible to adjust emacs theme with both light and dark?

You mean adapt the annotation theme with the emacs theme? Likely yes, do you have some documents about how light and dark theme for works in emacs?

Thanks! C.

emacs25 commented 1 year ago

maybe i should wait for your plan because i can't write elisp code for the function now.

i customize annotate color for different colors and add them into dark/light theme to adapt emacs theme.

cage2 commented 1 year ago

On Thu, Feb 09, 2023 at 01:58:57PM -0800, you wrote:

Hi!

maybe i should wait for your plan because i can't write elisp code for the function now.

Thanks for your patience!

In the meanwhile we can discuss the issue; what about if I add the chance to set a custom color for each annotation, using a prefix for the command `annotate-annotate'.

I am thinking to something like that:

annotate-annotation-color-highlights → '((:underline "coral") (:underline "khaki") ...)

annotate-annotation-colors → '((:background "coral" :foreground "black" :inherit default) (:background "khaki" :foreground "black" :inherit default) ...)

this way you could add a prefix to annotate-annotate, where said prefix would be an index to an element of the aforementioned lists, so typing:

C-u 1 annotate-annotate RET

would create (or even modify?) an annotation using the second element of the color list.

What do you think about this feature? Would this be good enough for you?

Bye! C.

emacs25 commented 1 year ago

thanks for your effort

actually i prefer loop colors automactically to select them by hand.

cage2 commented 1 year ago

On Sat, Feb 11, 2023 at 04:54:36PM -0800, you wrote:

Hi!

thanks for your effort

You're welcome, i am genuinely interest in this issue i just need one of the most precious things: time. 😔

actually i prefer loop colors automactically to select them by hand.

I was thinking that we could even get both, maybe! 🤔

This discussion is interesting, thanks!

Bye! C.

cage2 commented 1 year ago

Hi @emacs-newer

I worked on this feature, i hope to propose a pull request next week.

Bye! C.

emacs-newer commented 1 year ago

cool and thanks so much for your work!

cage2 commented 1 year ago

Hi @emacs-newer !

The patch in #151 hopefully added the feature you asked for; may you, please check if it works as expected?

if you want to change the annotation colors just customize these two variables:

You can add as much colors as you please but the length of the two lists must be the same.

As a bonus if you use a numeric prefix for the command annotate-annotate the prefix is interpreted as an index for the lists bound to the aforementioned variables, this way the user can force a specific color for each annotation.

Thanks in advance! C.

emacs-newer commented 1 year ago

okay, i will try it tomorrow.

thanks very much

cage2 commented 1 year ago

On Thu, Mar 16, 2023 at 12:09:05AM -0700, you wrote:

Hi!

okay, i will try it tomorrow.

thanks very much

Thanks a lot to you for helping!

Bye! C.

emacs-newer commented 1 year ago

works fine!

but how to add different colors to dark/light theme files?

there are secondary-xxx variables before,but now it seems no options to set up seprivately.

cage2 commented 1 year ago

On Sat, Mar 18, 2023 at 02:53:28AM -0700, you wrote:

Hi!

works fine!

Great! 🎉

but how to add different colors to dark/light theme files?

there are secondary-xxx variables before,but now it seems no options to set up seprivately.

Those two variables have been substituted by these ones:

https://github.com/cage2/annotate.el/blob/multiple-colors/annotate.el#L96 https://github.com/cage2/annotate.el/blob/multiple-colors/annotate.el#L103

in the code to change between dark and light theme just set the variable according to the theme.

For example if you are on a dark theme:

(setq annotate-highlight-faces '((:underline "white") (:underline "yellow") ... (setq annotate-annotation-text-faces '((:background "white" :foreground "black") (:background "yellow" :foreground "black") ...

on a light theme, instead

(setq annotate-highlight-faces '((:underline "black") (:underline "blue") ... (setq annotate-annotation-text-faces '((:background "black" :foreground "white") (:background "blue" :foreground "white") ...

to get a good contrast

Bye! C.

emacs-newer commented 1 year ago

okay, i'll try it later, thanks

cage2 commented 1 year ago

Hi @emacs-newer !

After merging #151 i think this report can be closed, feel free to reopen it if you think more work the patch doe not address the feature you proposed in the correct way.

Bye! C.