readium / readium-css

🌈 A set of reference stylesheets for EPUB Reading Systems, starting with Readium Mobile
https://readium.org/readium-css/
BSD 3-Clause "New" or "Revised" License
90 stars 20 forks source link

Theme boilerplate #6

Closed JayPanoz closed 4 years ago

JayPanoz commented 7 years ago

I need to design a boilerplate for the default stylesheet (cf issue #3) and Reading System themes. What is interesting is that, in theory, authors and users could use it too.

Here is a list of the settings I’ve currently implemented. Consider this a draft which may evolve depending on implementers’ feedback.

Once again, we’re leveraging CSS custom properties (a.k.a. variables) so you can choose to use them dynamically or “compile” them to fixed values beforehand.

Finally, the stylesheet is based on HTML5 Suggested Rendering. We’ll have to see if we need to take care of stuff like <p class="heading1"> or not (it’s probably not worth it considering we’ll always have edge cases we can’t manage properly).

Note to implementers:

CSS Variables are cascading, which means you get a lot of flexibility. If not set, they will simply fall back to the inherited/initial value, or the fallback you have set. In other words, you can have a stylesheet with variables which are not declared, anticipating the user adjusting settings.

You can define a new value for specific elements, you can set them as inline styles, you can manage themes as a simple set of variables (say using JSON) and the styles will update when you append them, you can build an UI so that users can make their own themes, etc.

I’ve written a doc if needed. They’re super powerful, can help ease a lot of issues, and you can always fall back to inline styles if they are not supported.

JayPanoz commented 6 years ago

Given our current approach, themes are now a simple combination of user settings, which means customized themes can be created on the fly and saved by the user (and cached by the RS).

This issue’d probably be left pending until developers can get their hands dirty in the implementation.

JayPanoz commented 6 years ago

Update: now that I’ve started working on themes and have like 5 well under way, question is do we stick to a combination of user settings and authors’ styles, or not?

For instance, you might want to center headings or apply a drop cap to get some classical feel, have block quotes in a slightly smaller font-size to make it more modern, etc.

So we would need an extra theming module (stylesheet) + flags to achieve that.

JayPanoz commented 4 years ago

Closing this issue to reopen a new and clearer one as it needs to be revisited.