• Hi,

    This may look like a very easy question, but somehow I was not able to find any info anywhere. I have a wordpress site, with two themes: dark and light. I have a toggle buton that changes this – it is done by the theme implementation itself.

    I would like to change the Enlighter theme programmatically, when I press dark/light page theme button change. All I was able to find out that I can change the theme settings in wordpress settings in general, but I do not wat that – I want it to be dynamic, depending on the toggle button position. All I was able to find out is this piece of code:

    EnlighterJS.init('pre', 'code', {
                    language : 'javascript',
                    theme: 'godzilla',
                    indent : 2
            });

    But when I add it the firebug style of editor do not change at all. How can I do this ?

    cheers

    • This topic was modified 3 years, 7 months ago by paweluz.
Viewing 1 replies (of 1 total)
  • Plugin Author Andi Dittrich

    (@andi-dittrich)

    there are two possible options to achieve such behaviour:

    1. (recommend) create your own EnlighterJS theme and wrap everything in a css class which is added to your body and represents the current page style e.g. theme-dark and theme-light

    2. (not recommended) change the theme class of EnlighterJS generated codeblocks to your desired theme using javascript (take a look into the generated DOM, it’s enlighter-t-<name>

Viewing 1 replies (of 1 total)
  • The topic ‘How to change theme programmatically’ is closed to new replies.