qooxdoo-compiler icon indicating copy to clipboard operation
qooxdoo-compiler copied to clipboard

Merging application and non-application themes

Open johnspackman opened this issue 7 years ago • 12 comments
trafficstars

The skeleton has always provided a custom theme with appearance, decoration, etc which inherit from a base theme, but would it be better if we simply used the standard theme directly? IE not create myapp/theme/* at all and in compile.json just specify the application theme as "qx.theme.Indigo".

My thought is that if you want to change the theme you're going to have to sit down and read the docs anyway so removing it would make the skeleton app simpler to understand and get started with, and removes cruft for more experienced users.

johnspackman avatar Jan 24 '18 05:01 johnspackman

It would make it simpler, but would make it more difficult to integrate third-party code that ships with custom (icon) themes. The dialog contribution, starting with v1.3 relies on the ability to replace the myapp.theme.Theme#meta.icon property with its own icon theme. If we shortcut to the framework themes, it gets much more difficult to insert the custom theme, I think.

cboulanger avatar Jan 24 '18 07:01 cboulanger

How about if contribs add their own theme elements by providing mixins and entries in compile.json? The compiler would then be able to get these installed into the app automatically.

This would mean that the qx commands to add and remove contribs would be able to easily (and automatically) add and remove the contrib's theme components from the build.

This could be implemented by having the compiler generate it's own theme source files (somewhere under source-output/) that uses all the necessary mixins, icon sets, etc; because it's just a theme .js file this would work without modification to the core framework.

If the developer wants to add their own overrides for appearance/decoration/etc they would specify these as mixins (these could be generated by the skeleton) and the compiler incorporates them in the same way as it does for contribs.

Advanced users would still be able to write their own theme, either from scratch (i.e. as we do now) or by starting with the one generated by the compiler. By writing your own theme from scratch, this would completely turn off the compiler's generated version and allow full control over theming.

johnspackman avatar Jan 24 '18 07:01 johnspackman

That would be much better than what I have now in the contrib, which can no longer work out of the box because of the custom icon theme which needs to be manually integrated. Your solution would allow installation without the end user having to do anything.

cboulanger avatar Jan 24 '18 07:01 cboulanger

@johnspackman I guess there are two cases.

  • A contribution provides a Theme. A complete one. So it should not mix in anything.
  • A contribution provides new widgets, icons, fonts, etc.

The latter one may by quite complicated as long as you don't force contributions to use an own appearance selector namespace for their own widget appearances: these mixins should not conflict with the existing application.

cajus avatar Jan 24 '18 07:01 cajus

I don't have an opinion yet apart from a significant interest in making theming more approachable. I think many people initially decide on a framework based on the looks.

oetiker avatar Jan 24 '18 07:01 oetiker

@cajus How would you solve the problem of the Dialog contrib trying to provide a custom icon themes for its widgets only without the developer having to include the aliases and assets manually in their application’s theme? Ideas?

cboulanger avatar Jan 24 '18 07:01 cboulanger

Sorry for accidentally closing, writing comments on the Smartphone doesn't always work well. What I mean is that a contrib must be able to NOT mess with the applications general icon theme (the "icon" alias) but be able to add its own aliases that come from different theme files (for example, a theme that uses Oxygen, one that uses Tango, and one that uses a third-party Iconset).

cboulanger avatar Jan 24 '18 08:01 cboulanger

@cboulanger using the current implementation, the user's theme has to be manually patched - but it looks like it would be straightforward for an automated process to do that, ie the compiler could produce the merged version

johnspackman avatar Jan 24 '18 10:01 johnspackman

Changed title to reflect the direction of the discussion.

This seems to be an important issue, but doesn't seem completely trivial. @johnspackman, what are the chances you can implement this (I don't think anyone else can do it) before release of v6?

cboulanger avatar Apr 29 '19 20:04 cboulanger

@johnspackman Revisiting this, because I just had the problem how to import the Dialog package's theme with icon aliases into the eventrecorder. This is how I am currently solving it, hardly ideal:

https://github.com/cboulanger/eventrecorder/blob/cf666f29e163ca34c0b0385cc044eb39f2f81a94/source/class/cboulanger/eventrecorder/UiController.js#L157

The immediate problem for me is the package's icon theme - but a solution should of course be more comprehensive and include all aspects of the plugged-in theme. Maybe it should be some property of Manifest.json/provides which would indicated that a theme is to be exported and to be integrated in the including app?

cboulanger avatar Aug 16 '19 06:08 cboulanger

Another (additional) way could be to have compile.json/applications[].theme optionally take an array of theme classes. However, this would require manually updating compile.json when installing a package. On the other hand, the Dialog package is a case where you can choose from different icon themes, which resolve the aliases to different icons. So the compiler must know which icon theme to use. Probably we therefore need some sort of "default" mode where the package's default theme settings are used, with the possibility to override those in the application.

cboulanger avatar Aug 16 '19 06:08 cboulanger

This is probably not going to happen for v6, is it @johnspackman ?

cboulanger avatar Jun 02 '20 10:06 cboulanger