a weird question. I want to be able to color specific days in different background in the Org-agenda buffer (created with org-agenda-list). I want it to be lets say every Monday and Wednesday. The aim is to get a nice visual queue to not schedule meeting during theses days so i can focus on actual work :). Ideally i would like the day header and all the time slots to get a different background on these specific days. any clue if that's possible?
Asked
Active
Viewed 976 times
3
-
Are you only referring to an `*Org Agenda*` buffer created with `org-agenda-list` -- i.e., *not* `org-tags-view`, and *not* `org-search-view`? Are the specific days to be arbitrarily determined by the user, or programmatically determined based upon a certain criteria (if so, what)? Will they be every Monday and Wednesday, or will they be the 1st, 8th, 9th, and 25th of *only* November, 2016? Is it just the divider line containing the date that should change color, or is it the task itself (e.g., the title *only* of the task)? Please give some specific thought as to the new feature request. – lawlist Nov 25 '16 at 18:54
-
thx and sorry for not being more clear, i edited the original post :) – zeltak Nov 26 '16 at 05:31
1 Answers
5
The following is a custom function, set with the built-in variable org-agenda-day-face-function
, that controls the colors of the date header in the *Org Agenda*
buffer generated by calling org-agenda-list
. In the context of the function calendar-day-of-week
, Monday is 1
and Wednesday is 3
.
If another forum participant would like to tackle the entries that appear underneath this date header, please feel free to write up an alternative answer.
(defun my-org-agenda-get-day-face-fn (date)
"Return the face DATE should be displayed with."
(let ((day-of-week (calendar-day-of-week date)))
(cond
((or (= day-of-week 1) (= day-of-week 3))
'(:background "red"))
((org-agenda-todayp date)
'org-agenda-date-today)
((member day-of-week org-agenda-weekend-days)
'org-agenda-date-weekend)
(t 'org-agenda-date))))
(setq org-agenda-day-face-function 'my-org-agenda-get-day-face-fn)

lawlist
- 18,826
- 5
- 37
- 118