Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Alternating Category Colors?

edited July 2007 in Vanilla 1.0 Help
I could swear I remember seeing a theme or add on that made this happen. I've already got all the CSS done on the forum I'm designing, so is there a place I can just add some code that would allow this to happen? If so, can someone show me the code and where to implement it? I would also like to set a background color for each comment, but when I do it creates a block around some of the text in the comment header. Is there a way to beat this? Thanks

Comments

  • Looking at the rendered HTML that's presented to my browser, I note that, at least for the standard theme used here, the rows on the discussion page are made up of list items <li></li> within an ordered list <ol></ol>. These list items belong to multiple classes, but if you look carefully, there's one class that only shows up on alternate items. It's, ah, "Alternate". Maybe my CSS-fu is weak, but I'm not sure how to make use of this without affecting the read/unread colours. What I'd really like is a directive that says "desaturate 20%" or similar, so I can use any hue, and have the read discussions in a clearly related colour. Or is there a way to do conditional classes- such as a virtual class that says "IF (class 'a' AND class 'b') { class definition that applies } ? i.e. if it is read, it is pale yellow. If unread, bright yellow. If read AND alternate, pale violet, if unread and alternate, bright violet. Though personally, I'd rather use different colours for different categories. I'm surprised the extension for this isn't one of the really popular ones- it seems to be languishing.
  • "desaturate 20%" <-- gonna have to wait for CSS3 support for that one squire, sorry.

    For now you will have to figure out the hex colour value of a 20% desaturated colour manually.
  • Oh, but it *is* on the cards? That's promising. Of course...if you rely on it as part of your interface, you're going to have issues for a few years while people are playing browser catchup. But I suppose as an *adjunct* to the interface, take what you can get. I can certainly handle working out the values for the, ahem, time being, but I'm not even sure how to do this without going into the PHP and altering it so instead of having the three independent classes- read, unread, alternate -we'd have read-standard, unread-standard, unread-alternate and read-alternate, all explicitly stating a background colour. It's not the very worst solution I suppose. Can I get at the list of classes that are generated without going into core code? Erm, not that I'm that bothered about alternating, personally, I think the rows are pretty clear in the standard theme...but it's just the OP got me thinking.
  • I just need the rows to alternate to fit the style I've created. It looks decent without it but we have a striped them that would really look great if I could alternate the rows between two colors as the go down.
  • I thought you already had read , read alternate, unread, unread alternate? Dont these things have multiple classes?
  • I thought that would be for Discussions and not Categories Forgive me. I am very new to this.
  • From the discussions page:

    <li id="Discussion_5577" class="Discussion Read NoNewComments Category_13"> <li id="Discussion_6748" class="Discussion Unread NewComments Category_10 Alternate">

    From the categories page:

    <li id="Category_10" class="Category UnblockedCategory FirstCategory Category_10"> <li id="Category_7" class="Category UnblockedCategory Category_7 Alternate">
    Seems we're missing "Read" and "Unread" on the categories - but you can certainly have the alternating colours already :)

    Perhaps we could add the Read/Unread thing to the list of wishes for the next release of Vanilla?
  • alright, so what do I have to edit to make the colors alternate? I cant find it in the vanilla.css. am I in the wrong place?
  • Building a query to check whether a user had read every single discussion in a category would be an absolute nightmare. I really dont see it happening.
  • -Stash- I cannot find that code anywhere. What file is that in? Also, in the Vanilla CSS, I don't see where I would change the code that would create the alternating colors for the Categories.
This discussion has been closed.