Skip to main content
Topic: Different colours for artists (Read 519 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Different colours for artists

Hi everyone,
Always managed to find answers and solutions without bothering the community too much. This time after a lot of searching I couldn’t find any help.
What I.m trying to figure out is how to assign a different color to certain artists in my filter panel, vs the “standard one” provided in my color scheme.

Is this something feasible?
Maybe it could be done assigning a different color to preferred artists... but Ik’m lost as how to do it

Thanks a lot,
RJ

Re: Different colours for artists

Reply #1
Anyone?

 :)) 

Re: Different colours for artists

Reply #2
Well, assuming you are talking about Columns UI filters, it's pretty straightforward: use the conditional statement $if() combined with the $rgb() function.
For example, if you want to set the font colour to red for all artists whose name begins with an "A", you can write in the field description something like:
Code: [Select]
$ifequal($strcmp($left(%artist%,1),A),1,$rgb(255,0,0),)%artist%
I'm late

Re: Different colours for artists

Reply #3
Thank you so much!

Yes, it's CUI filters.
Looked so easy (after your advice - before I had been playing randomly with the machine for days  :)) )

Now (and excuse me once more for my noobieness).

Suppose I want to turn in red a number of artists of my choice, which have nothing in common (they don't all begin with the A).

This string turns in red Bach
Code: [Select]
$ifequal($stricmp($left(%artist%,3),bac),1,$rgb(255,0,0),)%artist%
How can I add after "bac" - "cho" for chopin and "vel" for velvet underground?

I've tried with the $or and $xor functions but didn't manage to get it working.

Will seem again a super simple question for you - not for me tho!  O:)

Thanks again

Roberto

Re: Different colours for artists

Reply #4
Will seem again a super simple question for you - not for me tho!  O:)

Not really, I actually realized that the $rgb() function alters the sort order, as if there was a number in front of the artist name, therefore, all the names in red are sorted after those beginning with a special characters and before those beginning with a number. I never noticed something similar before and I actually don't know how to handle it. Does that happen to you, too?

Anyway, sort order issue aside, to compare the whole field with specific values I would use the $strstr() function rather than $strcmp(), for example:
Code: [Select]
$ifequal($strstr(%artist%,Bach),1,$rgb(255,0,0),
$ifequal($strstr(%artist%,Chopin),1,$rgb(255,0,0),
$ifequal($strstr(%artist%,Velvet Underground),1,$rgb(255,0,0),
)))%artist%

The above is just to get the idea, but to make it work properly in real life you need to manage capital letters and prefixes, like this:
Code: [Select]
$puts(ar,$stripprefix($lower(%artist%)))
$ifequal($strstr($get(ar),bach),1,$rgb(255,0,0),
$ifequal($strstr($get(ar),chopin),1,$rgb(255,0,0),
$ifequal($strstr($get(ar),velvet underground),1,$rgb(255,0,0),
)))$swapprefix(%artist%)
I'm late

Re: Different colours for artists

Reply #5
Quote
I actually realized that the $rgb() function alters the sort order, as if there was a number in front of the artist name
I had not noticed it as bach and chopin were my first entries as artists (I was playing within my "classical" collection)  :o

Setting that aside, it also happens that with your code (which by the way works perfectly for everything else) the artists that go "red" are not just bach but say also "BACHi da pietra". But anyway - that's just a detail. Am now trying to solve the "order" issue (which with my infallible trial and error strategy will take months to be sorted out  :'(

thank you davideleo

 

Re: Different colours for artists

Reply #6
Setting that aside, it also happens that with your code (which by the way works perfectly for everything else) the artists that go "red" are not just bach but say also "BACHi da pietra".
Sorry, I didn't understand you wanted it that way. The $stricmp() than is what you need.
I'm late

 
SimplePortal 1.0.0 RC1 © 2008-2020