jazz-soft / JZZ-gui-Player

MIDI Player for browsers
MIT License
12 stars 0 forks source link

Question - Styling the player with javascript #8

Open Andrew-J-Larson opened 1 year ago

Andrew-J-Larson commented 1 year ago

Is it possible to style the gui player with built in functions?

(if not, I know how I would go about doing this on my own... but I'd rather not)

jazz-soft commented 1 year ago

There are no special methods for styling, but you can hack into the code to find the DOM elements and style them.

Andrew-J-Larson commented 1 year ago

There are no special methods for styling, but you can hack into the code to find the DOM elements and style them.

What about on when the buttons change states? That ends up resetting the styles, would I have to programmatically also include style code in each onSpecialEvent?

Andrew-J-Larson commented 1 year ago

I've proposed this change, as I feel it would be much easier: https://github.com/jazz-soft/JZZ-gui-Player/pull/12

Andrew-J-Larson commented 1 year ago

Scratch my original idea, I think I have a better way to solve it. (but keep the code in, since it's good prep work for dynamic button adding)

Andrew-J-Larson commented 1 year ago

This is what I was after: https://github.com/jazz-soft/JZZ-gui-Player/pull/14

jazz-soft commented 1 year ago

Please document the use of styling.

Andrew-J-Larson commented 1 year ago

Aka. before instantiating anything, one would edit the theme by directly interacting with:

JZZ.gui.Player.theme

After they've made their modifications to it.

Then they could create their midi player element and connect it to the player to be used.

Andrew-J-Larson commented 1 year ago

If that's a bit too vague, I'm running on no sleep atm.

jazz-soft commented 1 year ago

If you enable styling, wouldn't it be more logical to style individual instances of the player?

Andrew-J-Larson commented 1 year ago

I do too believe so, that's why my push said that this was "basic theming support".

I don't expect it to stay that way, but I do figure you may have a better away of going about it, since I'm not much coder for dynamic theming or instances of objects.