Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Finding Specific StyleVars
mmfgamer5
Join Date: Mar 2010
Posts: 139

 

Show Printable Version Email this Page Subscription
mmfgamer5 mmfgamer5 is offline 08-06-2011, 10:00 PM

This is a technique that I have been using since I have been using vBulletin. This article will show you how to find specific StyleVars, with the help of a Firefox addon named Firebug. Firebug basically allows you to see the HTML/CSS of specific elements of webpages, and allow you to change those elements in real time.

How it works: Firebug allows you to right-click elements of a webpage, and then 'inspect' the code. This is useful, as say you want to change the "Recent Comments" text colour in your websites blog, it will help you to get the CSS element that contains the code which changes the colour of the element. You then take the CSS element and search for it in the templates (in the AdminCP). Then, where the colour is in the template, should hopefully be the StyleVar name. I'm probably not explaining it that well, so lets go into a step-by-step tutorial.


Main Tutorial
Step 1: Download Firebug here, and then install, restarting Firefox if required.

Step 2: Go to the page which the StyleVar you want to find is located on. Say you want to change the colour of some text, hover your mouse over this text, right click, and then click "Inspect Element".





Step 3: A popup should appear at the bottom of your browser. You will notice on the right is the CSS information. What you will be looking for is a hex colour (#000000, for example). Scroll down until you find one. Once you have found one, move your mouse over it, and you should see the actual colour which the code represents. If this colour is the same as that of the colour of the text you want to change, then go to step 4. If not, repeat until it is found.


Click here for larger image.



Note: If you get stuck at finding the variable, don't fret. Try right clicking on the element again. You can also hover your mouse over the "Inherited from" header in the CSS code.

Step 4: Now click on the hex code, and change it to something else (I usually change it to white or black, depending on whether it is a light or dark colour [#FFFFFF or #000000]). If you notice a colour change then you're in luck.


Click here for larger image.



Step 5: Above the variable, in black, should be a CSS element name. Make note of this name. Some of these elements will be separated by a comma - just make note of one of these elements.


Click here for larger image.



Step 6: Log in to your AdminCP, and go to Styles & Templates > Search in Templates. Set the "Search in Style" dropdown to the style which you want to change the StyleVar in. Then set the "Search for Text" to the name of the element which you noted earlier. Then click Find.


Click here for larger image.



Step 7: You should notice a few CSS templates. Click on the one which seems most appropriate. For the purpose of this tutorial, I have been inspecting the "Recent Comments" element in the blog, so I am going to double-click on the "blog.css" template to edit it.





Step 8: Click on the Find button to jump to the first instance of what you searched. In the CSS code underneath the highlighted text, look for a reference to colour. If there isn't one, click on the Find button again, repeat until you find a reference to colour in the CSS code.


Click here for larger image.



Step 9: Next to the "color" variable should be something which looks like this:
{vb:stylevar sidebar_header_color}
Copy the text between the "{vb:stylevar " and "}". This is the StyleVar name.


Click here for larger image.



Step 10: Now go to Styles & Templates > Style Manager > [your style] > Go (StyleVars should already be selected by default). Paste the copied text into the "Search Stylevar" edit box and press the Enter/Return key. You should see the list filtered down to the Stylevar name. Click on it, and edit as necessary.


Click here for larger image.

If you have any questions, suggestions, feedback etc, please do not hesitate to post below.

Last update: 10th of August 2011 at 17:46 GMT
  • More spacing in-between images and the next step.
Reply With Quote
  #2  
Old 08-10-2011, 04:44 PM
mmfgamer5 mmfgamer5 is offline
 
Join Date: Mar 2010
Posts: 139
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tips and Tricks
Finding colour StyleVars quickly: there is a small trick to help you find specific StyleVar colours. It basically uses Firebug to search in the CSS for the hex code of the colour you want to find. This can help if you are struggling to find a colour.

Step 1: Download Firebug here, and then install, restarting Firefox if required.

Step 2: Okay, first things first, click on the Firebug button in your browser (after going to the webpage of your choice, where you want to find the StyleVar). For me, it's up in the top right of the Firefox window. This will open the Firebug window without actually inspecting anything via the right click menu.





Step 3: Now, click on the CSS tab in Firebug. This will bring up the whole webpage's CSS.


Click here for larger image.



Step 4: Next, take a screenshot of the webpage, and paste it in Paint, Photoshop, Fireworks etc. Using the Pipette tool, click on the colour which you wish to find. Zoom right the way in, so you can be sure to select the lightest or darkest colour (in a gradient). If you're using a program such as Photoshop or Fireworks, which give you the hex code directly, copy that hex code. If you are using Paint, or something which does not give you the hex code directly, make note of the RGB code, then go here to convert it to a hex code. To find the RGB code in Paint, click on the "Edit Colours" button after selecting the colour, then get the Red, Green and Blue values from the text boxes.


Click here for larger image.



Step 5: After copying the hex code, paste it into the search box, and press the Enter/Return key.


Click here for larger image.



Step 6: Now it's time to check if you have the right code. Change the hex code to #FFFFFF (white) if it is a dark colour, or #000000 (black) if it is a dark colour. If it changes the colour of the element you're trying to find, awesome, if not, just try step's 5 and 6 again. I'll change the hex code to #000000.


Click here for larger image.



Step 7: If the colour changes, copy the black element text above the variables in the CSS. Some of the elements will be separated by a comma - just copy one of these elements.


Click here for larger image.



Step 8: Do steps 6 to 10 in the main tutorial.



If you have any questions, suggestions, feedback etc, please do not hesitate to post below.

Last update: 10th of August 2011 at 18:54 GMT
  • Minor layout changes.
Reply With Quote
  #3  
Old 08-13-2011, 05:49 AM
Taurus1's Avatar
Taurus1 Taurus1 is offline
 
Join Date: Dec 2009
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for an awesome tutorial. It really helps a lot!
Reply With Quote
  #4  
Old 08-16-2011, 09:32 AM
leejohn02 leejohn02 is offline
 
Join Date: Apr 2011
Posts: 90
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you can also use chrome, it has an inspect element, also helps if you want to custom ur css code for one specific thing and not the whole style vars, u can change seperate colors, within the elements to test, and the just add the code to the css
Reply With Quote
  #5  
Old 08-19-2011, 08:33 AM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent thread. :up:

Opera also has option to inspect element out of the box.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04673 seconds
  • Memory Usage 2,248KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (6)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete