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:
That did it, thanks ![]()
Here you go:
Why not
stripes? I guess
stripes are less⊠black and white?
Como vocĂȘ faria isso em uma pĂĄgina de detalhes de tĂłpico para respostas alternadas?
Isso Ă© um pouco mais complicado. VocĂȘ pode tentar aplicar o mesmo princĂpio Ă classe post-stream, mas ela nĂŁo contĂ©m apenas respostas, mas tambĂ©m âlacunasâ, como o 2 anos depois acima da sua postagem, entĂŁo elas tambĂ©m contam e podem ser afetadas.
Qual seria a melhor forma de implementar isso com cores diferentes dependendo se o tema claro ou escuro estĂĄ em uso?
Este tĂłpico pode responder Ă sua pergunta
:
Existem pelo menos dois métodos que funcionam:
nth-child(odd) uma cor como background: #80808040;.Se ajudar, publiquei um substituto de folha de estilo que demonstra o primeiro método⊠definindo cores por tema. Para detalhes, procure em style.css por quaisquer partes que contenham nth-child.
Aqui estĂĄ um exemplo de como fica em um tema claro:
⊠e cada tema tem suas próprias definiçÔes de cores, para que as linhas da tabela se ajustem a cada tema.