Back to vBulletin 5.x Template Modifications

[vBMods.rocks] Create an Inverted Color Theme off Existing Theme Using Just Few CSS
Mod Version: 1.00, by noypiscripter

vB Version: 5.5.5 Rating: (1 vote - 5.00 average) Installs: 2
Released: 04 Feb 2022 Last Update: Never Downloads: 0
Not Supported  

If you have a light theme in your forum, you can easily create a dark theme off it, or a dark theme into a light theme, using just few lines of CSS!

How cool is it that you don't have to customize every vB stylevars just to create a dark or light theme and you just let the browser do its magic to detect what the inverted color is for each the element on a page?

Here's a fun quick way to test how color inversion would look like in your own forum. Follow the below steps:
  1. Navigate to your forum to any page.
  2. Press F12 or right-click any element on your page and click Inspect or Inspect element.
  3. Open the Console tab.
  4. Paste the code below in the console.
    Code:
    $('body').css({filter:'invert(1)', 'backdrop-filter':'invert(0)'}); $('img,iframe').css({filter:'invert(1)'}); openAlertDialog({title:'Invert Color Theme Test by vBMods.rocks', message:"This is how your site would look like if colors are inverted. It still needs few CSS tweaks to undo color inversion on background images, icons, and others that you don't want to be inverted. You can try doing this test for each of your available styles/themes and for any page on your site.<br /><br/>NOTE: This style is obviously not saved to your site. It will go away when you reload this page."});
  5. Press Enter.
  6. Be amazed and say "Wow! "
If you want to proceed with this, then follow these steps to use it in your forum.
  1. Logon to AdminCP.
  2. Navigate to Styles > Style Manager.
  3. Find the style/theme you want to base the inverted color style from.
  4. In the "Choose Action..." dropdown, choose "Add Child Style".
  5. Rename the title as desired.
  6. Choose "No" in the Allow User Selection option. You will set it to "Yes" later when the style is fully ready.
  7. Click Save.
  8. Navigate to your forum.
  9. Choose the new style you just created. It should be exactly identical to it parent style since you haven't made any CSS changes yet.
  10. Go to AdminCP > Style Manager or SiteBuilder > Style > CSS Editor to edit the css_additional template of the new style you created.
  11. Enter the following CSS code. (The below code is just the base CSS code you need. You still need to add more code to it to undo the color inversion for any elements you don't want to be inverted)
    Code:
    	/* Invert Color Theme - START */
    	/* Invert color of all elements */
    	body {
    	    filter: invert(1);
    	    backdrop-filter: invert(0);
    	}
    	/* Undo invert of all images and iframes */
    	img,
    	iframe {
    	    filter: invert(1);
    	}
    	/* Invert Color Theme - END */
  12. Save.
  13. Reload your forum to see the style changes.
  14. To undo color inversion on elements you don't want to be inverted, do the following.
    1. Find the element.
    2. Right-click and choose Inspect or Inspect element.
    3. Find the id or class of that element. There may be multiple classes in it. You don't have to add them all. Post any questions in vbmods.rocks on how to identify which class to use and I will help you.
    4. Add the code in css_additional to undo the color inversion using the following format:
      Code:
      		/* Undo color inversion of specific elements */
      		#ThisIsTheId,
      		#ThisIsAnotherId,
      		.ThisIsTheClass,
      		.ThisIsAnotherClass {
      		     filter: invert(1);
      		}
      But if you want to keep the color inversion of the site logo, then add this CSS:
      Code:
      		/* Keep color inversion of site logo */
      		#header .site-logo img {
      		     filter: invert(0);
      		}
    5. Save.
    6. Reload your forum to see the changes.
    7. Keep finding new elements and adding new id or class to the above code.
  15. When you're ready, you can release the new style to the public by doing the following steps.
    1. Navigate to the new style by going to AdminCP > Style Manager > [New style you created] > Edit Settings.
    2. Set the "Allow User Selection" option to Yes.
    3. Save.
    4. Go to Settings > Options > Style & Language Settings.
    5. Set "Allow Users To Change Styles" to Yes.
    6. Save.
  16. Repeat the whole steps for every style/theme you want to create an inverted theme off it.
NOTE:
If you add new custom CSS in css_additional of the parent theme/style in the future, do not forget to also add it to the css_additional of the inverted-color child style.

Enjoy!

Please see attached screenshot of how it looks like for the vB5 Default Style when using this mod.

For more details and support, please head over to https://vbmods.rocks/forum/vbulletin-5-modifications/vbulletin-5-miscellaneous-modifications/23626-how-to-create-an-inverted-color-theme-off-existing-theme-using-just-few-css

Download

No files for download.

Screenshots

Click image for larger version
Name:	vbulletin-dark.jpg
Views:	79
Size:	57.8 KB
ID:	158929  

Similar Mods

Show Thread Enhancements [vBMods.rocks] Add Custom Profile Fields in Postbit vBulletin 5.x Products & Extensions
New Posting Features [vBMods.rocks] Quote Selected Text vBulletin 5.x Products & Extensions
Show Thread Enhancements [vBMods.rocks] Display Status Update in Postbit vBulletin 5.x Products & Extensions
Calendar Enhancements [vBMods.rocks] Event Date That Rocks using CSS vBulletin 5.x Template Modifications
Forum Display Enhancements [vBMods.rocks] Display Forum Description on Forum Channel page using an Ad Module vBulletin 5.x Products & Extensions

vblts.ru supports vBulletin®, 2022-2024