H5P-Nodejs-library
H5P-Nodejs-library copied to clipboard
feat(theme): add themes
It would also make sense to accomodate scenarios in which you have a per-content object theme that is configurable by the content author.
There are still details in content type editors that aren't styled: (didn't look at all of them yet)

I've fixed most of the issues above in the editor. There's mostly work to be done in the course presentation editor (it's various submenus).
I've noticed that it seems like a bad idea to override the color property of the body as this has many side effects. H5P is so complex that it's difficult to predict where there might be a panel with a hardcoded background color, so setting the color globally is dangerous as it can easily lead to situations in which there's white on white. It would probably be better to set the color in a more restricted way.
I haven't really looked at the player yet.
I've reviewed the state of the theme in the player and I think the approach of the PR isn't working out. Nearly all content types are broken in some way. I've reviewed about 40% (results below)
I suggest this:
- We have a list of content types that are supported (separate for editor and player).
- There are two themes, one for editor, one for player
- The CSS of the theme is never global but always scoped to the content type (in the player, and as far as possible also in the editor)
- The H5PEditor and H5PPlayer object decide whether to add a theme to the UI based on the content type
- There's a callback that implementations can pass in to disable themes for content (so that it is a setting for the content object)
- We go through the list of content types one by one and write SCSS for it, checking every feature and option. We avoid duplication using SCSS imports and mixins.
@JPSchellenberg @jankapunkt What do you think of this approach?

Wow, @sr258 you made an effort here. From my perspective this sounds good, especially with the scoping. We also use scss but I wonder if there are people who use just css or things like tailwind. Can they still use the theming then?
Yes, the theme builder compiles it to css.