PDA

View Full Version : Alt. colour based on style


Morrus
11-12-2013, 01:39 PM
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
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
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: <div class="bigusername">{param}</div>
Example: Your Text.
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
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
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!