How list tiddlers in color from a predefined set of colors and loop in color set?
Assume you have a set of four colors: red, green, blue, yellow
Next you have a $list which filters all tiddlers tagged with for example Learning
Now, I wish the $list shows the results in color selected from the above four colors and cycle through them. So, the first result is red, the second is green,… fifth is red again, sixth is green, seven result is blue, … and so on
I am looking for a simple general solution! I may have 8 colors or more!
Please share your solutions!
You can use colors HSL and play with them.
In first step you can change de hue (H), you can have, for example, steps of 30. from 0 to 330 (360=0) then you have 12 colors. If you need more color you can use short step(15, 10) and play with lightness (L) and sometimes (S) saturation.
You can do more complex combinations of colors playing with other filter operators. I’ve only used step of 30.
Offtopic: This idea isn’t new, some time ago i though about something like this to be used when we create new tags. But it was one of other ideas to work which I never started.
30 is a choice to use color wheel, 360/30= 12 colors and it gives a “distinguishable” color sequence. A bigger number gives small sequence of color but with less colors, and a smaller number gives more colors but they are worse distinguishable.
24 because is the double of 12 (our number of colors) ant then create a secuence of 12*2 number with remain[24] (1,2,…,22,23,0).
11 to split the sequence in two equal parts (12 & 12) to apply a different values of saturation and lightness.
40 and 35 are a random choice to change sat an L in our 12 colour. for example red i hsl is hue=0, sat=100%, lightnes=50% (the else values).
You can play sequence of colors and sequence of number and the number of parts of sequence number to create different “palettes”. And You can also add more complexity using other filter operators.
@Alvaro this could be re-witten as a macro which one supplies N and it returns the color number; eg; <span style=<<cycle-colour N>>
where cycle-colour reads “color: colornumber;”
Needs testing. may be better as returning 'style=“color: colornumber;” because I think you can use multiple “style=” in html.
Not quite sure what you’re asking, Tony. Maybe this helps?
Here’s how to override using CSS !important (usually not a good idea) which always “wins”. No matter how high I raise the specificity of the last css rule, the first one (with !important) wins:
Perhaps it depends, but depends on what, the only cause of apparent complexity comes from the use of !Important in the class, all the training says “important, do not use !important” and this is a simple example why not.