vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Alt. colour based on style (https://vborg.vbsupport.ru/showthread.php?t=304440)

Morrus 11-12-2013 01:39 PM

Alt. colour based on style
 
I'm hoping this isn't a programming question, but I'll start here.

I have two styles; black and white. Default text colours work correctly, as they should (light on the black, dark on the white).

However, I also need to be able to post snippets in news items in a different colour to the rest of the (default) text. I can't select a colour from the colour chooser, as one colour won't be suitable for both styles. So I need a way to select a 'alt default' colour which changes depending on the style in the same way that the default colour does.

So... how would I do that? Thanks!

Lynne 11-12-2013 04:54 PM

"post snippets in news items" ??? Where is this? Are you talking about making regular posts or what? I would say to use a class and then define that class in that style, but that may not work depending on where you are talking about these "post snippets".

Morrus 11-12-2013 05:20 PM

By "posts snippets in news items" I mean "part of the text in a post, usually using the CMS, but sometimes a regular forum post too".

Like this:

This is a new item. It contains a snippet like this: "This is the snippet. It's a different colour. This colour depends on what style I'm using." Continuing the news item in regular forum default colour.

Max Taxable 11-12-2013 05:24 PM

Sounds like you need a BB code that makes anything under it the second alternate color of the style?

Morrus 11-12-2013 06:00 PM

Is there a second alternate colour setting somewhere? Or are we talking programming templates and conditionals and stuff here?

Max Taxable 11-12-2013 06:09 PM

Quote:

Originally Posted by Morrus (Post 2460168)
Is there a second alternate colour setting somewhere? Or are we talking programming templates and conditionals and stuff here?

Styles and Templates>Style Manager>Style in question>All Style Options.

At least that's where to find it in vB3.8.7 - not sure if that's true of v4.

Scroll down until you find "Second Alternating Color."

You don't necessarily want to change that, you want to be able to call to it in script. In script, that call looks like <td class="alt2" or "alt1"

Morrus 11-12-2013 08:20 PM

I don't have 3.x; but from what I recall what you're referring to there is table row background colours, not font colours?

Max Taxable 11-12-2013 10:02 PM

You are right for some reason I was thinking of bg, like a quote box.

However if you create a custom BB code that allows you to pick any HEX color (such as #001D3E as a example) or even a pre-set one, it would apply to the type inside the BB tags, correct?

Only question now is, how to construct that custom BB code.

Lynne 11-12-2013 10:45 PM

You could add a special bbcode for it. Something that adds a class:

<span class="alt2">YOUR TEXT HERE</span>

and then you just define .alt2 in your additional.css template for each style.

Max Taxable 11-12-2013 11:07 PM

^^ DING DING DING!

Or you could even call up a already existing "additional css template" from the style if it's appropriate.

Morrus 11-12-2013 11:39 PM

So it looks like a B b code is the way to go. That's good news; an elegant approach.

The bad news? The only times I've ever edited CSS files is when I followed exact instructions. I don't actually know what I'm doing. Would anyone be willing to spare the time to walk me through this whole CSS and BB code creation? (I know where the Custom BB code panel is, and can make very basic ones, but I wouldn't know how to tie that in to a CSS).

Max Taxable 11-13-2013 12:12 AM

Quote:

Originally Posted by Morrus (Post 2460228)
So it looks like a B b code is the way to go. That's good news; an elegant approach.

The bad news? The only times I've ever edited CSS files is when I followed exact instructions. I don't actually know what I'm doing. Would anyone be willing to spare the time to walk me through this whole CSS and BB code creation? (I know where the Custom BB code panel is, and can make very basic ones, but I wouldn't know how to tie that in to a CSS).

Not knowing exactly what you need, I did a simple example calling on a existing style variation most all styles have: "bigusername"
I titled the BB code "stylevar"
BB code tag name "STY"
Replacement code:
HTML Code:

<div class="bigusername">{param}</div>
Example: [STY]Your Text.[/STY]
Description: Makes text in tags call the "bigusername" css definition
Use {option}: No
You can create a custom stylevar in "additional css definitions" and style it any way you want. Typical "bigusername" looks like this:
/* ***** styling for 'big' usernames on postbit etc. ***** */
.bigusername { font-size: 11pt; font-weight: bold; }

You can go something like:
/* ***** styling for news item snippet. ***** */
.newsitem { font-size: 11pt; font-weight: bold; and plus anything else - color? etc. }



Keep in mind you'll have to style the "additional css" definitions for this news snippet bit, in every style you have in order for it to appear the same (or even at all) across your styles.

Morrus 11-13-2013 12:25 AM

You know what? I'm an idiot. A complete and utter idiot.

There's already a BB code which does this. The [highlight] tag. It was just a matter of setting the stylevars for it.

I feel very foolish. Thanks for your patience and for taking the time! I'm sorry I wasted it.

Max Taxable 11-13-2013 12:27 AM

Quote:

Originally Posted by Morrus (Post 2460240)
You know what? I'm an idiot. A complete and utter idiot.

There's already a BB code which does this. The [highlight] tag. It was just a matter of setting the stylevars for it.

I feel very foolish. Thanks for your patience and for taking the time! I'm sorry I wasted it.

Hey no problem - I learned something too! I did not know this.

So who's the idiot? The guy who messes with coding a custom BB code no one needs because it's already there?:D

tbworld 11-13-2013 02:29 AM

Quote:

Originally Posted by Max Taxable (Post 2460242)
So who's the idiot? The guy who messes with coding a custom BB code no one needs because it's already there?:D

Been there done that. :)

Your still a good guy @Max Taxable, we can't take that away.

Max Taxable 11-13-2013 02:31 AM

E for effort right? Thanks!


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

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01110 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete