Author Topic: Getting skin color question  (Read 852 times)

boroda

  • Hero Member
  • *****
  • Posts: 4702
Steven, is it possible to get a control highlight color using the MB API?



if not, could you extend the API?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34415
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

boroda

  • Hero Member
  • *****
  • Posts: 4702
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.

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34415
try using 10
Setting_GetSkinElementColor(SkinElement.SkinInputPanel,...)

boroda

  • Hero Member
  • *****
  • Posts: 4702
no, SkinInputPanel is different. can't find a way to get these colors:



not sure if it's hard to add support for these colors, but if it's not, could you do?

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1097
  • Heal The World
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
I already spend hours on end on social media. Might as well spare a few of those to a greater purpose here.

boroda

  • Hero Member
  • *****
  • Posts: 4702
thanks Mayibongwe, but unfortunately theater mode IDs tell me nothing. I've never created any skins or theater modes myself.  :-\

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1097
  • Heal The World
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.
I already spend hours on end on social media. Might as well spare a few of those to a greater purpose here.

boroda

  • Hero Member
  • *****
  • Posts: 4702
...

________________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"

boroda

  • Hero Member
  • *****
  • Posts: 4702
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"?

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34415
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

boroda

  • Hero Member
  • *****
  • Posts: 4702
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: