dirtyroot
Mar 13 2007, 11:45
Hi, just a quick question. The answer is probably obvious but I have been searching for a while as well as manually messing the code in hope of getting it working, but with no luck.
I'd like to change the color of padded zeros to dark grey but I have no idea how to do this. So far I have $num(%LIST_INDEX%,4) which will, for example, show playlist track 14 as 0014. But I'd like to make the 00 a different colour. This image that I found shows the sort of thing I'm after in case I didn't explain it clearly enough.

Thanks in advance.
Yotsuya
Mar 13 2007, 12:04
Try something like this:
CODE
$rgb(128,128,128)
$ifgreater(%list_index%,9,,0)
$ifgreater(%list_index%,99,,0)
$ifgreater(%list_index%,999,,0)
$rgb(233,233,233)
%list_index%
wraithdu
Mar 13 2007, 12:10
Check Brother John's tutorial in the foobar wiki. He has example code and explanations to do what you are asking.
dirtyroot
Mar 13 2007, 12:19
Thanks for the help guys. I did look on tagz.brother-john.net but must have missed the relevant part as I was searching for something involving $num
Anyway cheers, I should be able to get it working now
Frank Bicking
Mar 13 2007, 12:38
CODE
$replace($pad_right($num(%list_index%,),$len(%list_index%),_),_,$rgb(144,144,144)0$rgb())
wraithdu
Mar 13 2007, 13:33
EDIT
Frank Bicking
Mar 13 2007, 13:46
Seriously, would you please try it out before you criticise it?
wraithdu
Mar 13 2007, 14:02
My apologies it seems. The description in the wiki is misleading -
--------------
$pad_right(x,len,char)
Pads x from the right with char to len characters.
--------------
Padded from the right sounds like it would yield a tracknumber like 1000, 2000. When talking about tracknumbers like 01, 02, 03 it is always referred to as 'padded from the left'.
dirtyroot
Mar 13 2007, 15:03
This is turning out to be a bit more difficult than I expected. Frank's method is closest to what I was after but it doesn't seem to have any permanant padded 0's at the start, they only appear when the tracklist reach's 10, 100 and 1000. Although the 0's are grey which is good


Yotsuya's method does not seem to take into account the 0's that are automatically added when the playlist reaches 10 / 100 / 1000. Can the added 0's be disabled? (The ones in white)

And I looked through the tutorial again but couldn't find anything which helped.
Again, this is the sort of thing I'm after. (The background colour doesn't matter though)
Frank Bicking
Mar 13 2007, 15:42
Replace this part by the number of digits you want:
$replace($pad_right($num(%list_index%,),$len(%list_index%),_),_,$rgb(144,144,144)0$rgb())
For example:
$replace($pad_right($num(%list_index%,),4,_),_,$rgb(144,144,144)0$rgb())
leokennis
Mar 13 2007, 16:19
My solution (only adds 1 "padding 0", but can of course easily be changed to add more 0's):
CODE
$ifgreater(%tracknumber%,9,%tracknumber%,$rgb(200,200,200)0$rgb(51,51,51)$right(%tracknumber%,1))
dirtyroot
Mar 13 2007, 17:09
Nice one Frank, that code is working fine. Seems the answer was relatively simple... I'd never have figured it out by myself though.
Thanks everyone else for your help too.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.