kiwanami / emacs-calfw

A calendar framework for Emacs
1.16k stars 100 forks source link

Different colors for different calendar org files? #115

Open fgilbert68 opened 5 years ago

fgilbert68 commented 5 years ago

Hi,

Not really an issue, rather a request for advice for something tricky I want to do.

I fetch my google calendars with org-gcal, resulting in ~10 files named something like google-calendar-xxx.org. I would like each calendar to appear with a different color. I found some code in calfw-org.el like cfw:org-create-source using a color argument, or defaulting to the SeaGreen4 default color.

Ideally I would like to call cfw:org-create-source with a different color value for each file, but inserting here some switch along file names looks ugly. Or maybe doing it where cfw:org-create-source is called, but I was not able to find where that happens, and that would be rather ugly too.

Any idea how to do that in some clean manner, preferably by adding code to .emacs rather than patching calfw-org.el ?

azzamsa commented 5 years ago

You mean "I would like each calendar to appear with a different color."?

Here is mine:

(defun my-calendar ()
    (interactive)
    (cfw:open-calendar-buffer
     :contents-sources
     (list
      (cfw:org-create-source "#e0a899")  ; orgmode source
      (cfw:cal-create-source "#ffffba")
      (cfw:org-create-file-source "Success" my-success-cal "#baffc9")
      (cfw:org-create-file-source "Success Atom" my-success-atom-cal "#E3FFE9")
      (cfw:org-create-file-source "Moment" my-moment-cal "#bae1ff")
      (cfw:org-create-file-source "Target" my-target-cal "#40e0d0")
      (cfw:org-create-file-source "Hevent" my-hevent-cal "#ffb3ba"))))
Ypot commented 4 years ago

You mean "I would like each calendar to appear with a different color."?

Here is mine:

(defun my-calendar ()
    (interactive)
    (cfw:open-calendar-buffer
     :contents-sources
     (list
      (cfw:org-create-source "#e0a899")  ; orgmode source
      (cfw:cal-create-source "#ffffba")
      (cfw:org-create-file-source "Success" my-success-cal "#baffc9")
      (cfw:org-create-file-source "Success Atom" my-success-atom-cal "#E3FFE9")
      (cfw:org-create-file-source "Moment" my-moment-cal "#bae1ff")
      (cfw:org-create-file-source "Target" my-target-cal "#40e0d0")
      (cfw:org-create-file-source "Hevent" my-hevent-cal "#ffb3ba"))))

Hi. What do these lines mean?


 (cfw:org-create-source "yellow")  ; orgmode source
      (cfw:cal-create-source "yellow")

I have tried to add them to my .emacs, to see if I can achieve this but I can't :s (newbie as hell here I am):

(defun my-calendar ()
    (interactive)
    (cfw:open-calendar-buffer
     :contents-sources
     (list
      (cfw:org-create-source "yellow")  ; orgmode source
      (cfw:cal-create-source "yellow")
     )))
azzamsa commented 4 years ago

This is my calfw config for now.

my-sucess-cal, my-moment-cal, etc. are just the variable which value is a path to my org files

e.g

(defvar my-moment-cal "cal/moment-cal.org")
(defvar my-success-cal "success-cal.org")
(defvar my-success-atom-cal "success-atom-cal.org")

You can put the path to your org files directly:

 (cfw:org-create-file-source "Success" "my-success-cal.org" "#baffc9")
 (cfw:org-create-file-source "Success Atom" "my-success-atom-cal.org" "#E3FFE9")

Feel free to ask if something wrong with your calwf config.