So I’m basically trying to make a speech system where, your response is the passage link, and I want the passage links to be different colors to kinda hint towards what they’re doing.
So in super simple terms.
I would make a passage link, say, green, instead of blue. Thanks!
<span class="positive">[[Yes sir, Hugo Wells, Pleased to make your acqaintance! And you are?|Carriage][$hugo.localtrustscore += 4]]</span>
\
@@.negative;[[Maybe I am, maybe I ain't. Who's askin'?|Carriage
][$hugo.localtrustscore -= 5]]@@
For some reason, the red always works. But I set positive to lime and green and it never changes the color.
If you switch the places of .positive and .negative does .positive still not work? My guess is there is something above .positive in the stylesheet that is messing with it.
First, I’d note that you should be careful when using colors alone to indicate things, since some people are colorblind. Red-green colorblindness is quite common. It would be best to add a symbol or something for those who can’t see colors.
You might also want to take a look at my “Multicolor links” sample code to see another way you can create colored links, and how to set up their “hover” color. (Click “Jump to Start” to see other sample code there.)
Also, can you post an example of the code where the “positive” class isn’t working? I suspect that the problem isn’t in the CSS, it’s actually in how you’re setting the style. So I’d look there.
I agree! I honestly didnt want any indication of what your responses were doing, but everyone play testing said they wish they knew.
How would I add symbols? That sounds super neat.
You can use a CSS selector than includes either a :before or :afterpseudo-class to attached content like a Plus or Minus symbol to the start or end of each of your links.
The CSS Content article on the CSS-Tricks web-site explain the concept in greated detail.
So assuming your Passage content looks something like the following…
/* Using SugarCube Custom Styling markup... */
@@.positive;[[Yes sir, Hugo Wells, Pleased to make your acqaintance! And you are?|Carriage][$hugo.localtrustscore += 4]]@@
@@.negative;[[Maybe I am, maybe I ain't. Who's askin'?|Carriage][$hugo.localtrustscore -= 5]]@@
/* Using HTML elements... */
<span class="positive">[[Yes sir, Hugo Wells, Pleased to make your acqaintance! And you are?|Carriage][$hugo.localtrustscore += 4]]</span>
<span class="negative">[[Maybe I am, maybe I ain't. Who's askin'?|Carriage][$hugo.localtrustscore -= 5]]</span>
…then CSS like the following will append either a plus or minus symbol, between open and close parentheses, to the end of the link…
…and if you want those symbols to appear before the link instead of after then simply replace the :after pseudo-class in above CSS with the :before pseudo-class one and change the margin from margin-left to margin-right.
note: I have removed the earlier suggested link colour changing related CSS because, as explained by HiEv, it would make your story less Accessible to those with specific vision related issues.
(Note: I just used two sample icons I had lying around for that example. The “TestX” stuff is only there to show that the link fits normally within text, even with the icon next to it.)
You can use the Base64 Encode/Decode site to encode your icons, like I did in the “neg” class. However, I’d strongly recommend only using base64 encoding for very small image files, such as icons, since they bloat up the HTML file.