Lightning Template - a few more questions

MadKiwi
Topic Author
Posts: 11
3 years 5 months ago - 3 years 5 months ago #4490 by MadKiwi
Hi there C Lodder

I recently added a Kunema Forum to my site (Joomla 4+ using Lightning template)
however it seems to incorporate Bootstrap,

which is fine but it changes the look of the cards (menu's etc) ,
I may be able to restyle these but even more noticeable is when
the user switches to Dark Mode the forum & side menus (cards)
remain in light mode, Joomla 4 comes with bootstrap 5

and I see that the latest bootsrap 5.3 now supports a dark & light mode
so that's where I'm at currently trying to integrate it ...

so via overrides, I have added Bootstrap 5.3 via CDN into index.php

the effect I'm trying to intergrate with the theme color switcher
should be similar to

www.codeply.com/p/BmyKLq8RTV


so I've been trying to add the overide into the switch.js file

but as it uses a button rather than a switch I'm not sure about the right way to add in the code
(as there are many variables in the switch.js as well,

I'm not sure where I'm going wrong
I was hoping maybe you could help me figure out how to correct this line of code
or suggest a better solution?

.............................................................................................................................................................................

document.getElementById('color-scheme-switch').addEventListener('click',()=>{
if (document.documentElement.getAttribute('data-bs-theme') == 'dark') {
document.documentElement.setAttribute('data-bs-theme','light')
}
else {
document.documentElement.setAttribute('data-bs-theme','dark')
}
})

...............................................................................................................................................................

I've been frustrated trying to get this to work with no luck ,

I noticed your site uses dark & light mode and the Kunena forum
so I was hoping you may have already solved this issue I'm having
and I'd be interested to hear your solution or any tips you could help me with
that could point me in the right direction ?

Thanks in advance :)

- Sharn
Last edit: 3 years 5 months ago by MadKiwi.

Please Log in or Create an account to join the conversation.

Lodder
Lodder's Avatar
Posts: 1264
3 years 5 months ago #4491 by Lodder
Replied by Lodder on topic Lightning Template - a few more questions
Hi Sharn,

Here is a working example of the switcher with BS 5.3

www.codeply.com/p/Z3UENp4FKG

Hopefully it will set you in the right direction.

Regards,
Lodder

Please Log in or Create an account to join the conversation.

MadKiwi
Topic Author
Posts: 11
3 years 5 months ago #4492 by MadKiwi
Replied by MadKiwi on topic Lightning Template - a few more questions
Awesome , C-lodder

Thanks so much :)

Please Log in or Create an account to join the conversation.

MadKiwi
Topic Author
Posts: 11
3 years 5 months ago - 3 years 5 months ago #4493 by MadKiwi
Replied by MadKiwi on topic Lightning Template - a few more questions
Hi C Lodder

Thank you for your dark switch example,
It helped me out a lot & I've had fun learning + experimenting with the template,
the Hiq CCS framework can work well with Bootstrap theme variables
(Judging by my experiments) ,

Q#1 -> I was wondering if you could explain the Third state ' Standard '
are these referencing the Cassiopeia .css (which only uses the $primary variables?)
or is the standard mode using the values of the initially declared variables in the template.css?

Q#2 -> Also, I know Google Font API's had some controversy but despite this, after entering my API key
the Fonts do not seem to populate .... is this because Google has made changes to the way the API's work?
If so I do hope the option is not redundant - as its a handy option,

-As maybe I could change/replace the line in the source code re: template index.php file
from 'fonts.googleapis.com/css2' to another source like 'fonts.bunny.net/' instead?
- (only as a quick fix if Google API is no longer an option)

Thanks again for the great template and the great support :) ,

(I hope to donate towards your coffee fund sometime soon )
- Sharn
Last edit: 3 years 5 months ago by MadKiwi. Reason: (dyslexia!) + format & spelling changes

Please Log in or Create an account to join the conversation.

Lodder
Lodder's Avatar
Posts: 1264
3 years 5 months ago #4495 by Lodder
Replied by Lodder on topic Lightning Template - a few more questions
Hi Sharn,

When you say "Standard State", are you referring to when the switcher is in the middle? If so, then this detects the theme defined by your Operating System. For example, if you're using dark theme on Windows/MacOS, and the switcher is in the middle, the Lightning template will use the same theme.

I've tested Google Fonts and they work perfectly fine. After entering an API key, click "Save", and then the list should populate.

Regards,
Lodder

Please Log in or Create an account to join the conversation.

MadKiwi
Topic Author
Posts: 11
3 years 5 months ago #4497 by MadKiwi
Replied by MadKiwi on topic Lightning Template - a few more questions
Hi C lodder

ah ha so thats what 'Standard' (middle switch) relates to , thank you
(I had no idea that it was possible to detect the Operating System Theme
- but that's good that it can be done , without changing O.S themes I would not have noticed)

Interesting about the Google fonts , So it must be user error
... there is something I'm not doing right, but that narrows the solution down
maybe I've put in the wrong API key or something -

I don't think it's from an ad blocker / a browser extension either as I've had no luck across browsers,
but that's o.k , again thank you - it must be something I'm not doing right rather than the template
(or as I initially suspected that the Google API had changed somehow is not the fault after all)

I will keep trying to fix that ... in the meantime, there are other ways to load in Google Fonts
Thank you for testing that for me on your Template

- Sharn

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum