How do you set alternating colors in the list of topics? It helps usability a lot, but it is all white by default.
example:
How do you set alternating colors in the list of topics? It helps usability a lot, but it is all white by default.
example:
You can achieve this with a CSS customization. Hereās an example to get you started:
.topic-list-item:nth-child(even) {
background-color: #EEE;
}
.topic-list-item:nth-child(odd) {
background-color: #FFF;
}
Hereās how this looks on Meta:
And for those who are looking to change the background of topics, hereās the solution:
div.topic-post:nth-child(odd), div.small-action:nth-child(odd) { background-color: #FAFBFF; } div.topic-post:nth-child(even), div.small-action:nth-child(even) { background-color: #F6F6FF; }
And hereās the discussion about why it isnāt the default anymore:
@fefrei Care to extract this into a super simple theme component? 
@Silvanus same for your topic tweak. I was thinking maybe weād just include it in the ātiger striping componentā but commented out by default, but we might as well make it a component of its own as they really are two completely separate pieces of styling.
Sure!
Can you tell me why I cannot use $primary-low in the theme component? Itās used all over the place in core (e.g. as the background color of buttons), and I think itās a good color for the darkened rows, but itās undefined:
Error: Undefined variable: "$primary-low".
on line 2 of theme_field.scss
>> background-color: $primary-low;
----------------------^
Iāve run into the same problem. What solved it for me was adding this at the top:
@import "common/foundation/variables";
And then you can use those colors.
Thatās the short story, the long story is here:
Why not
stripes? I guess
stripes are less⦠black and white?
How would you do this on a topic detail page for alternating replies?
That it somewhat more involved. You can try applying the same principle to the post-stream class, but this not only contains replies, but also āgapsā, like the 2 years later above your post, so they also count and may be affected.
Qual sarebbe il modo migliore per implementarlo con colori diversi a seconda che sia in uso il tema chiaro o scuro?
Questo argomento potrebbe rispondere alla tua domanda
:
Ci sono almeno due metodi che funzionano:
nth-child(odd) un colore come background: #80808040;.Se può essere dāaiuto, ho pubblicato una sovrascrittura di foglio di stile che dimostra il primo metodo⦠impostando i colori per tema. Per i dettagli, cerca in style.css qualsiasi parte contenente nth-child.
Ecco un esempio di come appare in un tema chiaro:
⦠e ogni tema ha le proprie definizioni di colore, quindi le righe della tabella si adattano a ciascun tema.