0

I am asking myself if it is possible for an existing website to let the anonymous visitor select another template on the fly.

The idea behind this is: There are people out there that prefer e.g. a dark theme or a high contrast theme of the page. This might be a personal preference or a requirement due to some inabilities (red/green, blue/yellow color blindness,...). Now, I'd like to put a module somewhere to switch to a new set of styles.

The current page uses a configurable template and a dozen styles that define different background colors depending on the current section of the page. So, I would like to define a second set of styles and have them switch depending on a cookie or so.

The other alternative I could think of was to alter the template itself. It would have double the number of settings (one regular color and one for the second theme). Depending on a cookie or something similar, either of the color settings would be in effect. A module must be there that just alters that cookie if the user wants to switch themes. As the template is self-written, this was possible in general, but I would have to check all the details.

Both solutions seem tedious to me. For the second, I would most probably know how to achieve it but it is the most restricted one. The first could work with a plugin but I'd have to dig into it for a clear statement.

Now I wonder: Is there no better way to get there? Do I miss the obvious answer to get the page best suited for accessibility issues?


Edit 1

As I have seen, it seems not quite clear what I mean/need. Let me give you a bit more insight.

The page consists of different departments. Each department is associated with color-coding. So, for example, one department is blue and the other one is red. This is solved so far by having a template that is configurable and that allows setting a color property that in turn will be used if the user is navigating a certain page.

Speaking Joomla: There are multiple styles of the same template one for each department and the menu entries are associated with the style corresponding to the department.

When I allow my users to switch e.g. to a high contrast version, I do want to have the blue department to have a high contrast blue (however this is done) and the red department a high contrast red styling. If the visitor (in high contrast mode) navigates from department red to blue, I want the page to keep in high contrast mode.
The user should not be required to switch all modes individually. Nor should the complete page be in one monochrome high contrast scheme or all colors be mixed up.

With the existing extensions to let the visitor select the template manually (is it really the template or the style?), I see the problem that all my color-coding might go to hell and each user has his own colo styling. Worst case even the normal colors might get mixed up (like the user accidentally made the red department blue).

1 Answer 1

1

If you do a search on 'Joomla Template switcher' you will get a number of hits for extensions that allow the site visitor to switch which template they want to use.

Joomla used to supply its own selector/switcher as module but I can't recall seeing in Joomla3 and can't see it in Joomla4.

I found two in the first couple of pages of Google, one in JED and another in Github.

1
  • The thing is: I need to switch bunches of styles and not single templates/styles. I will edit the question to clarify my use-case a bit. Jan 30 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.