Latest topics
» IconSkouliki
by skouliki Sun 17 Sep 2017, 11:05

» Awards
by Mr_Grande Sun 17 Sep 2017, 08:52

» Modify Category Tabs lead to a desired position and auto scroll click
by djblah Fri 15 Sep 2017, 14:56

» Display a preview of the user profile on hover
by Eiki Thu 14 Sep 2017, 02:38

» [GAME] Count to 30 - Ange Edition
by SLGray Mon 11 Sep 2017, 14:23

» Rank CSS
by Mr_Grande Fri 08 Sep 2017, 09:24

» make the topic a color
by Ultimas Wed 06 Sep 2017, 19:44

» Chit Chat Thread
by Valoish Sun 03 Sep 2017, 23:20

» The like/thumbs up or down feature
by Dr.kran Sun 03 Sep 2017, 19:21

» My text boxes are glitched, can you help with this type of problem?
by Wolfuryo Sun 03 Sep 2017, 17:08

» User - Made Creations
by SLGray Sun 03 Sep 2017, 16:25

» FM Themes
by SLGray Sun 03 Sep 2017, 16:24

» i need to add css improvement
by Wolfuryo Sat 02 Sep 2017, 12:12

» How do I add hover examine feature?
by Dr.kran Wed 30 Aug 2017, 16:43

» [GAME] World Snake
by SLGray Wed 30 Aug 2017, 14:46

Recent Tutorials
Top posting users this month
Who is online?
In total there are 5 users online :: 0 Registered, 0 Hidden and 5 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

Dark Theme Help

View previous topic View next topic Go down

avatar
Haggis
Member
Title :
Gender : Female
Posts : 24
Points : 462
Reputation : 1
Location : Scotland
Language : English, Russian, Scots
Browser : Browser : Safari Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

PostHaggis on Sat 25 Mar 2017, 04:54

Hello,
I am back Very Happy Today I have a question regarding the dark theme. I tried searching for the code, but I am not sure if I can even change this. So the body of my forum has a colour assigned. I'd like this to change when using the dark theme. Here's what my forum looks now (with the theme). Please help bounce



Thank you SOOOO much!


Last edited by Haggis on Mon 27 Mar 2017, 21:25; edited 1 time in total
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4684
Points : 9727
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Sat 25 Mar 2017, 17:44

Hi @Haggis,

Just to clarify ; this is with Dark Mode applied, correct ?
avatar
Haggis
Member
Title :
Gender : Female
Posts : 24
Points : 462
Reputation : 1
Location : Scotland
Language : English, Russian, Scots
Browser : Browser : Safari Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

PostHaggis on Sun 26 Mar 2017, 01:01

Hi @Ange Tuteur, yes, it is! :c
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4684
Points : 9727
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 27 Mar 2017, 11:54

Okay, good. Go to Admin Panel > Modules > JS Codes management > ALL.JS

Find :
Code:
/* -- 11. dark mode -- */
(function() {
  window.fae_lightSwitchMode = my_getcookie('fae_light-switch-mode') || 'dark';

  document.write('<style type="text/css">#fae_light-switch-container{margin:6px 0}#fae_light-switch-label{font-weight:700;vertical-align:middle}#fae_light-switch{background-color:rgba(0,0,0,.25);vertical-align:middle;display:inline-block;position:relative;height:26px;width:56px;border-radius:20px;cursor:pointer;overflow:hidden}#fae_light-switch>input{display:none}#fae_light-switch>div{background-color:rgba(255,255,255,.5);position:absolute;top:3px;left:3px;height:20px;width:20px;border-radius:20px;transition:.4s;font-size:13px;font-weight:700;line-height:22px}#fae_light-switch>div:before{content:"ON";margin-left:-24px;color:transparent;transition:.4s}#fae_light-switch>div:after{content:"OFF";margin-left:30px;color:rgba(255,255,255,.5);transition:.4s}#fae_light-switch>input:checked+div{background-color:#FFF;left:33px}#fae_light-switch>input:checked+div:before{color:#FFF}#fae_light-switch>input:checked+div:after{color:transparent}</style>');

  var footer = '.footer-links.left',

      cookie = my_getcookie('fae_light-switch'),
      rgb,
      button,
      container,

      changeTheme = function (cookie) {
        var button = document.querySelector('#fae_light-switch input');

        if ((button && button.checked) || cookie == 'on') {
          my_setcookie('fae_light-switch', 'on', true);

          if (window.sessionStorage && window.sessionStorage.faeLightSwitch) {
            $('head').append('<style type="text/css" id="fae_light-switch-css">' + window.sessionStorage.faeLightSwitch + '</style>');
          } else {
            $.get('https://raw.githubusercontent.com/SethClydesdale/forumactif-edge/master/css/dark-mode/' + fae_lightSwitchMode + '-mode.min.css', function (d) {
              $('head').append('<style type="text/css" id="fae_light-switch-css">' + d + '</style>');

              if (window.sessionStorage) {
                window.sessionStorage.faeLightSwitch = d;
              }
            });
          }

        } else {
          var css = document.getElementById('fae_light-switch-css');

          my_setcookie('fae_light-switch', 'off', true);

          if (css) {
            document.head.removeChild(css);
          }
        }
      };

  cookie && changeTheme(cookie);

  $(function() {
    if (!my_getcookie('fae_light-switch-mode')) {
      rgb = window.getComputedStyle(document.body, null).getPropertyValue('background-color').replace(/rgb\(|\)|\s/g, '').split(',');
      fae_lightSwitchMode = Math.round(((parseInt(rgb[0]) * 299) + (parseInt(rgb[1]) * 587) + (parseInt(rgb[2]) * 114)) /1000) > 125 ? 'dark' : 'light';

      my_setcookie('fae_light-switch-mode', fae_lightSwitchMode, true);
    }

    footer = document.querySelector(footer);

    if (footer) {
      button = document.createElement('LABEL');
      button.id = 'fae_light-switch';
      button.innerHTML = '<input type="checkbox" ' + (cookie == 'on' ? 'checked="true"' : '') + '/><div></div>';
      button.firstChild.onchange = changeTheme;

      container = document.createElement('DIV');
      container.id = 'fae_light-switch-container';
      container.innerHTML = '<span id="fae_light-switch-label">' + (fae_lightSwitchMode == 'dark' ? 'Dark Mode : ' : 'Light Mode : ') + '</span>';

      container.appendChild(button);
      footer.appendChild(container);
    }
  });
}());

Replace with :
Code:
/* -- 11. dark mode -- */
(function() {
  window.fae_lightSwitchMode = my_getcookie('fae_light-switch-mode') || 'dark';

  document.write('<style type="text/css">#fae_light-switch-container{margin:6px 0}#fae_light-switch-label{font-weight:700;vertical-align:middle}#fae_light-switch{background-color:rgba(0,0,0,.25);vertical-align:middle;display:inline-block;position:relative;height:26px;width:56px;border-radius:20px;cursor:pointer;overflow:hidden}#fae_light-switch>input{display:none}#fae_light-switch>div{background-color:rgba(255,255,255,.5);position:absolute;top:3px;left:3px;height:20px;width:20px;border-radius:20px;transition:.4s;font-size:13px;font-weight:700;line-height:22px}#fae_light-switch>div:before{content:"ON";margin-left:-24px;color:transparent;transition:.4s}#fae_light-switch>div:after{content:"OFF";margin-left:30px;color:rgba(255,255,255,.5);transition:.4s}#fae_light-switch>input:checked+div{background-color:#FFF;left:33px}#fae_light-switch>input:checked+div:before{color:#FFF}#fae_light-switch>input:checked+div:after{color:transparent}</style>');

  var footer = '.footer-links.left',
      customCSS = '#page-body { background:#333; }',

      cookie = my_getcookie('fae_light-switch'),
      rgb,
      button,
      container,

      changeTheme = function (cookie) {
        var button = document.querySelector('#fae_light-switch input');

        if ((button && button.checked) || cookie == 'on') {
          my_setcookie('fae_light-switch', 'on', true);

          if (window.sessionStorage && window.sessionStorage.faeLightSwitch) {
            $('head').append('<style type="text/css" id="fae_light-switch-css">' + window.sessionStorage.faeLightSwitch + customCSS + '</style>');
          } else {
            $.get('https://raw.githubusercontent.com/SethClydesdale/forumactif-edge/master/css/dark-mode/' + fae_lightSwitchMode + '-mode.min.css', function (d) {
              $('head').append('<style type="text/css" id="fae_light-switch-css">' + d + customCSS + '</style>');

              if (window.sessionStorage) {
                window.sessionStorage.faeLightSwitch = d;
              }
            });
          }

        } else {
          var css = document.getElementById('fae_light-switch-css');

          my_setcookie('fae_light-switch', 'off', true);

          if (css) {
            document.head.removeChild(css);
          }
        }
      };

  cookie && changeTheme(cookie);

  $(function() {
    if (!my_getcookie('fae_light-switch-mode')) {
      rgb = window.getComputedStyle(document.body, null).getPropertyValue('background-color').replace(/rgb\(|\)|\s/g, '').split(',');
      fae_lightSwitchMode = Math.round(((parseInt(rgb[0]) * 299) + (parseInt(rgb[1]) * 587) + (parseInt(rgb[2]) * 114)) /1000) > 125 ? 'dark' : 'light';

      my_setcookie('fae_light-switch-mode', fae_lightSwitchMode, true);
    }

    footer = document.querySelector(footer);

    if (footer) {
      button = document.createElement('LABEL');
      button.id = 'fae_light-switch';
      button.innerHTML = '<input type="checkbox" ' + (cookie == 'on' ? 'checked="true"' : '') + '/><div></div>';
      button.firstChild.onchange = changeTheme;

      container = document.createElement('DIV');
      container.id = 'fae_light-switch-container';
      container.innerHTML = '<span id="fae_light-switch-label">' + (fae_lightSwitchMode == 'dark' ? 'Dark Mode : ' : 'Light Mode : ') + '</span>';

      container.appendChild(button);
      footer.appendChild(container);
    }
  });
}());

This modification will add a new string called "customCSS" that allows you to define custom CSS rules for dark mode. Just find this variable and add in the additional styles you want. Wink
Code:
customCSS = '#page-body { background:#333; }',
If any questions, let me know. Smile
avatar
Haggis
Member
Title :
Gender : Female
Posts : 24
Points : 462
Reputation : 1
Location : Scotland
Language : English, Russian, Scots
Browser : Browser : Safari Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile

PostHaggis on Mon 27 Mar 2017, 21:25

You are the best <3 @Ange Tuteur
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4684
Points : 9727
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Wed 29 Mar 2017, 12:58

You're welcome. ^^

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum