Color coding the text of a Book's chapters and subchapters - so I can easily tell them apart

Color coding the text of a Book's chapters and subchapters - so I can easily tell them apart

Frankie Kam發表於
Number of replies: 1
Plugin developers的相片

Hi All

I've tried to search Moodle.org on how to do this:
I want to color code a Book module's TOC in terms of different color and weight. Specifically, different color and/or weight for the Chapter, Sub-Chapter and for the currently visited Chapter/Sub-Chapter. I think I got it, but not all of it is working.

Before applying Custom code.  My TOC looks like this:


Observe that the black bold text is the part of the Book (1.3 How to change your password) that I have clicked on. Therefore the black text is the currently visited link of the Book.

Notice also the scroll-of-death since the Book module does not have a feature to auto-collapse sub-chapter text. I have no idea why this collapse-feature has not been implemented for the Book module. Perhaps there is a already a Tracker. But I digress...

...as you can see the Chapters and sub-chapter text are the exact same color and weight. The only things to differentiate a Chapter from sub-chapter are UPPERCASE/lowercase, indentation and number coding. My point is that in terms of color, they are identical.

Based on this post on StackOverflow, I then applied this code to the Custom CSS of my theme (evolve-D):

.path-mod-book .block_book_toc ul > li {
    list-style: outside none none;
    font-weight: bold;
    color: #00137F;
}

.path-mod-book .block_book_toc li li {
    list-style: outside none none;
    font-weight: normal;
}

Here's the result of applying the CSS code:


The difference now is that the Chapters are formatted in bold.  This is definitely an effective improvement because, now, I can better distinguish between a Chapter text and a sub-chapter text. Hooray, but I want to do more!

I don't suppose anyone knows how to make the color of the Chapter text and the sub-chapter text different? Despite the advance I have made in differentiating Chapter text from sub-chapter text, I am unable to make the sub-chapter text as a different color, for example black, whilst maintaining the Chapter text as blue.

Any help or assistance would be appreciated.

Regards
Frankie Kam, Malaysia


評比平均分數:Useful (1)
In reply to Frankie Kam

Re: Color coding the text of a Book's chapters and subchapters - so I can easily tell them apart

bobby demers發表於

I have seen that done Frankie.

Another college here in London has managed it. It is a very useful function

I'm making enquiries as to how they did it. If I can find out I'll share it back here for you (and the rest of the community)


Regards


sox