Reputation: 38766
(Note: While I'm not entirely sure if this be better asked on SuperUser, I guess the fact that you probably will have to mess around in the xpi/jar file with the css settings, should make it suitable for SO.)
Mozilla Thunderbird's Calendar extension, Lightning, will use different colors for different calendars, and just use a narrow vertical bar for the category color: (Light blue as calendar color and red as category color)
What I would like to find out is how I could go about changing/"hacking" the css styles that - surely - must be associated with this, buried somewhere in the plugin directory, so that in the example above, the event would be fully colored red.
Anyone know how to achieve this?
Upvotes: 14
Views: 19545
Reputation: 3133
Ten years later, all previous answers are either out-of-date or are too complicated.
This answer targets the latest Thunderbird (v102.6.0), supports native category colors, and only contains 3 lines of custom CSS.
Please follow the steps below:
Unlock custom CSS as mentioned in this post:
Goto Tools > Settings > General > Config Editor...
, and set toolkit.legacyUserProfileCustomizations.stylesheets
to true
.
Locate your profile folder as mentioned in this post:
%APPDATA%\Thunderbird\Profiles\xxxxxxxx.default\
~/.thunderbird/profiles/xxxxxxxx.default/
~/Library/Thunderbird/Profiles/xxxxxxxx.default/
Create chrome/userChrome.css
under the profile folder. For example, the full path for Windows will look like: %APPDATA%\Thunderbird\Profiles\xxxxxxxx.default\chrome\userChrome.css
Modify chrome/userChrome.css
to contain the following CSS:
.calendar-category-box {
width: 100% !important;
}
Restart Thunderbird
Change the calendar color to white for better visuals:
(Optional) Customize the category colors:
Goto Tools > Settings > Calendar > Categories
and set custom category colors.
All done!
In the future, if Thunderbird introduce breaking changes, you may need to slightly modify the CSS based on the inspection results in Tools > Developer Tools > Developer Toolbox
.
Upvotes: 8
Reputation: 1
I am not a programming person so I found a way around modifying codes.
You can go around that by creating several individual calendars (e.g. that you can call work, personal, birthdays, etc.). You can choose the background color of each calendar. If you make the calendars all visible at the same time (by checking the calendar boxes on the left side), what you enter in each calendar will have a different background color, not just a stripe to the right.
When you create a new event, instead of selecting a category, leave 'none' for category but select a calendar in the calendar dropdown menu and assign your event to a particular calendar (each have different background colors).
The only downside of that is that you need to export all individual calendars if you would like to export your calendars at some point. But otherwise it works.
Upvotes: 0
Reputation: 1819
This extension looks perfect for the functionality you want.
https://addons.mozilla.org/en-us/thunderbird/addon/calendar-tweaks/
To have just this, uncheck all the options, and check these:
Upvotes: 8
Reputation: 992
The category-overlay.png image is merely a gradient overlay to give the category bar the right looks.
Two options here. One more easy but not as reliable, the other a bit more difficult:
Create a userChrome.css in your $profile/chrome/ directory. It should contain the following:
.calendar-color-box[categories~="mycategory"], .calendar-event-box-container[categories~="mycategory"] { background-color: #abc123 !important; }
You'll need to do this for each category you'd like to change the color for. Note that changing the color of the category in the Lightning options won't change the category color you set here.
You'll need to modify some files inside lightning.xpi here. This solution merely requires you to set the category colors in Lightning and will also work for newly added categories. Note that this way events without a category are transparent, if you want more you'll have to do it on your own.
If you'd rather see a patch, this applies to the latest comm-central source:
diff --git a/calendar/base/content/calendar-month-view.xml b/calendar/base/content/calendar-month-view.xml
--- a/calendar/base/content/calendar-month-view.xml
+++ b/calendar/base/content/calendar-month-view.xml
@@ -52,21 +52,20 @@
<bindings id="calendar-month-view-bindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="calendar-month-day-box-item" extends="chrome://calendar/content/calendar-view-core.xml#calendar-editable-item">
- <content mousethrough="never" tooltip="itemTooltip">
+ <content mousethrough="never" tooltip="itemTooltip" class="category-color-box">
<xul:vbox flex="1">
<xul:hbox>
<xul:box anonid="event-container"
- class="calendar-color-box"
xbl:inherits="calendar-uri,calendar-id"
flex="1">
<xul:box class="calendar-event-selection" orient="horizontal" flex="1">
<xul:stack anonid="eventbox"
class="calendar-event-box-container"
xbl:inherits="readonly,flashing,alarm,allday,priority,progress,status,calendar,categories"
flex="1">
<xul:hbox class="calendar-event-details">
diff --git a/calendar/base/content/calendar-multiday-view.xml b/calendar/base/content/calendar-multiday-view.xml
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -2119,20 +2119,19 @@
]]></handler>
</handlers>
</binding>
<!--
- An individual event box, to be inserted into a column.
-->
<binding id="calendar-event-box" extends="chrome://calendar/content/calendar-view-core.xml#calendar-editable-item">
- <content mousethrough="never" tooltip="itemTooltip">
+ <content mousethrough="never" tooltip="itemTooltip" class="category-color-box">
<xul:box xbl:inherits="orient,width,height" flex="1">
<xul:box anonid="event-container"
- class="calendar-color-box"
xbl:inherits="orient,readonly,flashing,alarm,allday,priority,progress,status,calendar,categories,calendar-uri,calendar-id"
flex="1">
<xul:box class="calendar-event-selection" orient="horizontal" flex="1">
<xul:stack anonid="eventbox"
align="stretch"
class="calendar-event-box-container"
flex="1"
xbl:inherits="context,parentorient=orient,readonly,flashing,alarm,allday,priority,progress,status,calendar,categories">
diff --git a/calendar/base/content/calendar-view-core.xml b/calendar/base/content/calendar-view-core.xml
--- a/calendar/base/content/calendar-view-core.xml
+++ b/calendar/base/content/calendar-view-core.xml
@@ -46,21 +46,21 @@
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="calendar-editable-item">
<content mousethrough="never"
tooltip="itemTooltip"
- tabindex="-1">
+ tabindex="-1"
+ class="category-color-box">
<xul:vbox flex="1">
<xul:hbox>
<xul:box anonid="event-container"
- class="calendar-color-box"
xbl:inherits="calendar-uri,calendar-id"
flex="1">
<xul:box class="calendar-event-selection" orient="horizontal" flex="1">
<xul:stack anonid="eventbox"
class="calendar-event-box-container"
flex="1"
xbl:inherits="readonly,flashing,alarm,allday,priority,progress,status,calendar,categories">
<xul:hbox class="calendar-event-details">
This would be the best working hack, although it requires javascript changes. Open calendar.jar as described in Option B and check out calendar-views.js, there are two functions: updateStyleSheetForViews()
and updateStyleSheetForCategory()
. I'll leave this to people that want to tinker with it themselves, but the idea would be to add a rule for .calendar-color-box[categories~=...]
that overrides the default rule in case there are categories. This way if there is no category set, the calendar color is used, otherwise the desired category color.
Have fun :)
Upvotes: 10
Reputation: 38766
Thanks to speedballs answer I was able to locate the file that controls the Category Overlay: There is a PNG file under:
....\extensions\{e2fda1a4-762b-4020-b5ad-a41df1933103}\chrome\calendar.jar\
skin\calendar\category-overlay.png
The width of this file is 7px, and enlarging it's width will enlarge the Category Color Overlay in the calendar view. (I just used GIMP to scale it horizontally.)
So it would appear that it is not possible to use the category to fully color the whole event, as it's color is only mapped in via a "hardwired" pixel-width of the overlay png.
Upvotes: 0
Reputation: 517
Just updated the way i've done things with the different ideas on this page... I was the author of the "french post" and I just needed another way to inverse colors...
So there it is for your pleasure (and my users too !!)
This is a unified diff ouptut of the modifications made on the lightning xpi (more precisely the calendar.jar package inside of it)
You may find all the informations on the original post : http://www.geckozone.org/forum/viewtopic.php?f=22&t=89384&start=15#p646027
For the non french speakers, here is some translation : Hello everybody,
Here is a more correct version of the changes. The big plus compared to my previous proposal is that we do not need anymore to define the colors of categories / calendars in the file userChrome.css that is also not used at all!
Overall:
Apply changes to XML files to allow the use of "calendar-id" and "categories" on the various elements of the DOM.
Update the file "calendar-views.js" to apply the parameterized color categories and calendars but by inverting them.
Finally, some css changes in "calendar-views.css" for:
Also, the image /skin/calendar/category-overlay.png has been expanded to increase the size of the border ...
Note: It only remains to put all this stuff as an option, but I did not have time to look over there at the moment ... But if one of you can give me some avenues of research, I will give it a try !
All the best :)
Vincent
Upvotes: 1
Reputation: 11
Image of daily calendar
Image of weekly calendar
ALL CODE BY: TOUT SÉLECTIONNER
This is a several step process that I have translated from a french website. I am simply making a note of what worked for me. This is for thunderbird 3.1.9. for the lightning-1-1.0b2-tb-macosx.xpi plugin. These directions were written April 8th, 2011. These directions are specifically for Mac users, although you can probably use them for windows as well.
Anything in ALL CAPS, means that you need to swap out your own information. Example: [email protected]
Part 1:
/* */
is not recognized as code by thunderbird (or anything that reads .css) It is only there as a notation by the person(s) that coded it. Example /*TEXT*/
The Code:
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
.calendar-event-box-container[categories] { margin: 1px !important;} /* add margin to the category-box */
.calendar-color-box:not([categories]) { color: black !important; background-color: #A6A6A6 !important;} /* events without category will appear grey */
calendar-category-box:not([categories]) { display: block !important; } /* category-box always displayed even if event doesn't have a category */
/* 2- using the calendar uri (much better) */
.category-color-box[calendar-uri="http://my.caldav.server/path/to/file"]{ background-color: #FF0000 !important; display:block !important; float:right;}
/* display the category-box with the specified color (forced color of the calendar) */
/* for each category, assign a forced color
each category must be spelled lowercase in the css, spaces replaced with '_'
I didn't make any test with accents... but they may work (lowercase, spaces -> _) eg: "Appel Téléphonique" -> "appel_téléphonique"
*/
.calendar-color-box[categories="CATEGORY_NAME1"] { color: black !important; background-color: #CCCCFF !important;}
.calendar-color-box[categories="CATEGORY_NAME2"] { color: black !important; background-color: #FF99FF !important;}
.calendar-color-box[categories="CATEGORY_NAME3"] { color: black !important; background-color: #FF0000 !important;}
.calendar-color-box[categories="CATEGORY_NAME4"] { color: black !important; background-color: #CC33CC !important;}
.calendar-color-box[categories="CATEGORY_NAME5"] { color: black !important; background-color: #0000FF !important;}
Part 2: Now comes the complex part - taking apart the lightening plugin, one step at a time, putting it back together and loading it as a modified plugin into Thunderbird.
-> calendar/content/calendar/calendar-month-view.xml
Line 64
< xbl:inherits="calendar-uri,calendar-id"
> xbl:inherits="calendar-uri,calendar-id,categories"
Line 95
< <xul:calendar-category-box anonid="category-box" xbl:inherits="categories" pack="end"/>
> <xul:calendar-category-box anonid="category-box" xbl:inherits="categories,calendar-uri" pack="end"/>
-> calendar/content/calendar/calendar-multiday-view.xml
Line 2135
< <xul:calendar-category-box anonid="category-box" xbl:inherits="categories" pack="end" />
> <xul:calendar-category-box anonid="category-box" xbl:inherits="categories,calendar-uri" pack="end" />
-> calendar/content/calendar/calendar-view-core.xml
Line 59
< xbl:inherits="calendar-uri,calendar-id"
> xbl:inherits="calendar-uri,calendar-id,categories"
Line 84
< xbl:inherits="categories"
> xbl:inherits="categories,calendar-uri"
Line 394
< xbl:inherits="categories">
> xbl:inherits="categories,calendar-uri">
Part 3:
Select the contents of the ORIGINALPLUGIN FOLDER.
Calendar-js
chrome
chrome.manifest
components
defaults
install.rdf
modules
timezones.sqlite
Right-click the selected items and select "compress 8 items"
. . . and that should be it. It worked for me. I will check back to see if anyone else had luck with this, if not, I will double check my notes.Thanks to TOUT SÉLECTIONNER for writing the oringial code.
Upvotes: 1
Reputation: 947
You should install the DOM Inspector addon to understand the XUL structure of an event. Together with userChrome.css you should be able to style it the way you want it.
Upvotes: 2