Help - Search - Members - Calendar
Full Version: Changing colour of padded zeros in playlist
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
dirtyroot
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.

IPB Image

Thanks in advance.
Yotsuya
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
Check Brother John's tutorial in the foobar wiki. He has example code and explanations to do what you are asking.
dirtyroot
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 smile.gif
Frank Bicking
CODE
$replace($pad_right($num(%list_index%,),$len(%list_index%),_),_,$rgb(144,144,144)0$rgb())
wraithdu
EDIT
Frank Bicking
Seriously, would you please try it out before you criticise it?
wraithdu
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
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 smile.gif
IPB Image



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)
IPB Image



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)
IPB Image
Frank Bicking
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
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
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.
Invision Power Board © 2001-2008 Invision Power Services, Inc.