getmusicbee.com

Support => Developers' Area => MusicBee API => Topic started by: boroda on November 27, 2023, 06:28:00 AM

Title: Getting skin color question
Post by: boroda on November 27, 2023, 06:28:00 AM
Steven, is it possible to get a control highlight color using the MB API?

(https://i.imgur.com/sh6QMrT.png)

if not, could you extend the API?
Title: Re: Getting skin color question
Post by: Steven on November 27, 2023, 07:03:10 AM
i can extend the api for v3.6
Setting_GetSkinElementColor(2,...) will return the button color
if it returns 0 then its an older MB version, and -1 indicates that windows native buttons are used
Title: Re: Getting skin color question
Post by: boroda on November 27, 2023, 07:13:18 AM
thanks a lot. another request (if it's not too hard): provide a way to get the button background color (gray in the above screenshot), which seems to be different from the background colors of all other elements.
Title: Re: Getting skin color question
Post by: Steven on November 27, 2023, 07:19:02 AM
try using 10
Setting_GetSkinElementColor(SkinElement.SkinInputPanel,...)
Title: Re: Getting skin color question
Post by: boroda on November 27, 2023, 07:41:33 AM
no, SkinInputPanel is different. can't find a way to get these colors:

(https://i.imgur.com/n3Oby9R.png)

not sure if it's hard to add support for these colors, but if it's not, could you do?
Title: Re: Getting skin color question
Post by: Mayibongwe on November 27, 2023, 12:25:26 PM
Some time last year, I went through the API skin colours to see what skinning elements they matched with, and this is what I'd jotted down:
Not sure how relevant it is to this discussion, but I will just put it out there.

SkinSubPanel & SkinTrackAndArtistPanel map to Panel.ChildBody.Default (where bdr and fg are the same)
SkinInputPanel & SkinInputPanelLabel map to InputPanel.Default
SkinInputControl maps to Controls.InputControl.Default

Verified against hiccup's sample skin
Title: Re: Getting skin color question
Post by: boroda on November 27, 2023, 09:14:28 PM
thanks Mayibongwe, but unfortunately theater mode IDs tell me nothing. I've never created any skins or theater modes myself.  :-\
Title: Re: Getting skin color question
Post by: Mayibongwe on November 28, 2023, 06:54:20 PM
I've had a chance to go through the thread properly.
Disregard the above - neither of those green-coloured skin elements (which the API currently derives colours from) will give you access to the button colours.
But Steven's already said he's willing to extend the API to include them - so that's good news.



________________Additional FYI_______________

On the one plugin project I've created so far, I found the best solution to be to provide skinning overrides myself (separate from MB).
By default, the Library Quiz plugin derives its colours from the API, but at the same time, also allows users to change them should they wish to (it creates a plugin editable xml file).
Though I'm not sure the same solution would be as easy to implement on the AT&RT plugin given that it's been in development for years and has thousands of lines of code by now.

Another thing I'd attempted to do was to acquire the current skin path (which the API provides) and then query it to get the element colour of interest.
That would also have worked except in cases where a bitmapped/compiled skin was used.
Title: Re: Getting skin color question
Post by: boroda on November 28, 2023, 08:21:45 PM
...

________________Additional FYI_______________
Another thing I'd attempted to do was to acquire the current skin path (which the API provides) and then query it to get the element colour of interest.
That would also have worked except in cases where a bitmapped/compiled skin was used.

thanks, it's interesting idea, but unfortunately: "except in cases where a bitmapped/compiled skin was used"
Title: Re: Getting skin color question
Post by: boroda on December 11, 2023, 09:26:58 AM
i can extend the api for v3.6
Setting_GetSkinElementColor(2,...) will return the button color
if it returns 0 then its an older MB version, and -1 indicates that windows native buttons are used

Steven, MB 3.6.8736 returns strange negative numbers for (SkinElement)2, both for foreground and background colors. maybe you meant "if it returns negative number other than -1 then its an older MB version"?
Title: Re: Getting skin color question
Post by: Steven on December 11, 2023, 10:48:54 AM
the number includes an alpha component which would normally return a negative number. Maybe -1 wasnt the best choice
Use color.fromargb(value) to get the color
Title: Re: Getting skin color question
Post by: boroda on December 11, 2023, 07:31:41 PM
i got confused because very many skins use the color returned by Setting_GetSkinElementColor(2,...) in many places. i think that Setting_GetSkinElementColor(2,...) actually returns the generic background color of buttons. it's a useful color because it can't be auto-generated from other available colors, so please leave it as is. (Btw, does Setting_GetSkinElementColor(2,...) return the correct foreground color either? most skins use similar foreground colors in many places, so it's hard to find out it myself). anyway, thank you very much.

but what i meant by "skin accent color" in the OP is button background mouseover color (foreground mouseover color would be helpful too). this color is frequently used as a selected menu item background too (but it seems that not always; this might depend on the skin). see screenshot:

(https://i.imgur.com/zI17StJ.png)
Title: Re: Getting skin color question
Post by: The Incredible Boom Boom on December 28, 2024, 02:13:28 PM
but what i meant by "skin accent color" in the OP is button background mouseover color (foreground mouseover color would be helpful too). this color is frequently used as a selected menu item background too (but it seems that not always; this might depend on the skin). see screenshot:

(https://i.imgur.com/zI17StJ.png)

@boroda, @Steven, was control over this "accent"/"highlight" color ever implemented?