Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Setting global colours in CUI (elplaylist, Item details, WSH mod) (Read 6958 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Setting global colours in CUI (elplaylist, Item details, WSH mod)

I'm trying to set a global theme colour from tags in CUI. Basically I'm trying to make the whole of foobar change to match an RGB tag in the currently playing track.
Trouble is, I'm at a loss. ELPlaylist doesn't seem to support scripting the background colour (only manually selecting), "Item Details" doesn't seem to support changing the background at all, and WSH... well WSH I'm still trying to get my head around.
So my questions 1 2 and 3 are, if anyone can help...

1. What's the most reliable way of setting a global variable, and where would I do it? It just need to read the tag of the currently-playing track.

2. Does anyone know how to script the background colour of ELPlaylist, or Item Details?

3. WSH - I've copied someone's code for album art display, and I *think* this is the bit I need to change: "window.GetColorCUI(3)" - but what should it show, and how can I access file tags in WSH?

Any and all help much appreciated! Thanks!

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #1
Anyone?

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #2
You could use panel stack splitter as a base (parent) splitter. Use $drawrect in the panel stack splitter script to draw a background rectangle of full width and height according to your tag colour. Script code runs on track change. Set el_playlist and wsh panel mod to use a pseudo transparent background. Position panels in panel stack splitter with forced layout and $movepanel for best background refresh. This method is restricted to panels that can be made transparent (e.g. you can also use channel spectrum, lyrics3 etc, but not item details [code the equivalent in panel stack splitter or better still wsh panel mod instead] and not most library viewers although es_playlist may work for you graphically or you may be able to find a wsh panel mod library viewer script with searching).

To answer your specific questions.

1. Your tag is a global variable that can be read by most panels. Problem is that you cannot script the background of many panels.
2. You can script the background in el_playlist with $drawrect but it will only show where there are displayed tracks.
3. You would need to go through the wsh panel mod documentation.

Simplest solution is as described in the first paragraph.

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #3
Thanks, that's really helpful. I'm really struggling with WSH and PSS, but I guess I'll have to learn the scripts! Beyond what you download with WSH, is there any documentation? The examples are a little tricky to understand, and I can't see any using standard track metadata. Has anyone coded a WSH "Item Details" panel?

Thanks,

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #4
elplaylist and PSS expect RGB colours separated with dashes like this...

Code: [Select]
255-0-0


so if your tags contained values like that, simply using %tag% in the colour part of the various $drawtextex or $drawrect functions should work.

with WSH panel mod, there is an RGB function you can use...

Code: [Select]
function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}


so now you have 2 things to consider here: getting the tag and then splitting it into 3 values which you can pass into this function. there is a function named fb.TitleFormat which you can use like this

Code: [Select]
var temp_colour = fb.TitleFormat("%tag%").Eval()


note the above Eval() part only works on the playing track. if you want it to work on the selected track regardless of whether foobar is playing or not, you can do this...

Code: [Select]
var metadb = fb.GetFocusItem();
var temp_colour = fb.TitleFormat("%tag%").EvalWithMetadb(metadb);


now we have the value, we can use the javascript split function which creates a new array with the 3 RGB values.

Code: [Select]
var colour_array = temp_colour.split("-");
//finally pass the 3 values of this array to the RGB function.
var colour = RGB(colour_array[0], colour_array[1], colour_array[2]);


you can try picking apart this theme as it has WSH item details panel. http://extremehunter1972.deviantart.com/ar...013-4-368146015

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #5
Thanks a lot, that's really helpful.
I just have 2 problems left now - firstly, is it possible to share variables between ELPlaylist sections? That is, 'group header', 'per second' and 'tracklist'? I can get the font to display in the colour of the album it belongs to, but not the now playing album.
And secondly, WSH works with the transparency great apart from one thing, which is that it doesn't refresh the transparent part properly. That's to say, on album changes (ie new PSS background) the transparent bit of WSH displays the last album. It disappears (ie updates) if I resize the window however. I've tried using window.Repaint() but with no joy. Is this a PSS or a WSH code issue?

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #6
with ELplaylist, there is a field definitions tab where you can set variables to be shared without having to duplicate them.

as for the PSS/WSH transparency, try using $movepanel_c in your PSS code to force it to redraw the WSH panel. this might work but i don't use columns anymore so i can't test

$movepanel_c(my wsh panel,0,0,%ps_width%,%ps_height%)

the name in bold is whatever it's called on the Panellist tab and you might want to tweak the x,y,w and h values. you'll need to make sure forced layout is enabled for the panel as well.

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #7
Thanks, the movepanel worked like a charm!
As for the ELPlaylist field definitions, I can't see how to set them using script? I've tried entering the tag as the value but it still reads it differently each time. I want to set it in 'group header' then call it in 'track list', but even if I use $put(a) in 'Group header', then the field definition of %b% as $get(a), calling %b% in 'track list' doesn't work.

Is there a way to do $put(%b%,a) ? If I try that, it doesn't work - is there a different store command in the script?

Thanks again for all your help.

Setting global colours in CUI (elplaylist, Item details, WSH mod)

Reply #8
whatever name you give a variable on the field definitions tab, you can access it in all the other tabs using %% around it like this

%myvariable%