Popup text colour

Can someone not change the colour of the text of a popup within a popup? I tried wrapping {colour:White: } around the popup but that did nothing


The man is carrying a {popup:spade:A spade is a tool {colour:red:put in your text} commonly used for digging holes.} over his back.

I used red because white is hard to see.
You can learn more about it at
https://docs.textadventures.co.uk/quest/quest5_7.html


Thanks. I was using the colour over the text, not the long text. I'm not sure why that wouldn't work. Maybe it was a typo which I copied and pasted several hundred times but the print was small so I can have missed something. I also agree I should have tested a stronger colour before deleting all that work.
So I tested a sample within the popup on the start svreen
'''{colour:Red:{popup:red:hello}}'''
and all that shows up is the word red in the original grey.
How do I change the colour of the word "spade"?

However, I can change the colour of the actual long text, so I can change each piece of text that isn't a popup, inside the popup long text, and that is a lot more work, but usefull.


{colour:Red:{popup:red:hello}}

The contents of the popup are a separate div, not contained within the same output div; and the clickable link is set to the colour defined as game.altlinkforeground if it exists, and game.defaultlinkforeground otherwise.

When you put two colours inside each other, the innermost one overrides the outer. That's why you can put a red word in the middle of a blue sentence, or stuff like that.

So, if you want to have red text inside a link that's automatically coloured whatever colour altlinkforeground is, you would need to use:

{popup:{colour:red:red}:hello}

Or if that doesn't work (I think it should, but…) you could try:

{popup:{colour:red !important:red}:hello}

(the !important CSS keyword is useful for changing which rule wins when there's a conflict)


mrangel
Neither the first sample nor the second worked. Instead, I git
colour:
followed by a lot of spaces
in the same colour as the rest of the long text in that larger popup, grey, not red. I can colour long text, but not "text" before the "longtext", within a popup or otherwise.


If you are trying to change the hyperlink colour:

game.defaultlinkforeground = "red"
msg ("{popup:spade:A spade is a tool commonly used for digging holes.}")
game.defaultlinkforeground = "black"

More possible help:
https://textadventures.co.uk/forum/quest/topic/3128/link-foreground
https://textadventures.co.uk/forum/quest/topic/rwulivlvskyvtd3d0sklsg/change-colors-mid-game


Bah… I know that bug. It's already been fixed (as of Quest 5.8 I think) for {random and {either, but apparently we missed {popup.

To make it work as intended, you'd need to change Split to Tsplit in one of the core functions:

<function name="ProcessTextCommand_Popup" parameters="section, data" type="string"><![CDATA[
  section = Mid(section, 7)
  ary = Tsplit(section)
  s1 = StringListItem(ary, 0)
  list remove(ary, s1)
  s2 = Join (ary, ":")
  id = JSSafe(s1) + GetRandomInt(0, 999999999)
  link = game.defaultlinkforeground
  if (HasString(game, "altlinkforeground")) link = game.altlinkforeground
  s = "<span  style=\"cursor:pointer;color:" + link + ";\" onclick=\"$('#" + id + "').css('display', 'block');\">" + s1 + "</span><div id=\"" + id + "\" class=\"w3-theme-border\" style=\"position:fixed;z-index:9999;display:none;cursor:pointer;left:50px;top:40%;width:40%;background-color:" + game.defaultbackground + ";border:2px solid " + game.defaultforeground + ";color:" + link + ";border-radius:5px;padding:5px;\" onclick=\"$('#" + id + "').css('display', 'none');\"><p>"
  s = s + s2 + "</p></div>"
  return(ProcessTextSection(s, data))
]]></function>

Explanation: Split (section, ":") cuts the text inside the command up where the colons are. The function then assumes that everything before the first colon is the short text, and everything after the first colon is the popup contents. It's better to use TSplit, which finds the first colon that isn't between { and } - meaning that the colons inside the nested {colour directive can do their job.


@daeun

If you are trying to change the hyperlink colour:

Good workaround :) I was going to suggest that, but thought it would be more complex than necessary.
That's probably the simplest way to do it if you're on the web version.

Another alternative would be something like:

{popup:<font color="red">red</font>:hello}

which is deprecated, but doesn't have a colon in to cause problems.


Thanks, you two, for all this information. I have already filled my first layer popups with long text in a different colour from the links and it was trouble to change so much but it works now. However, the more I know the more I can try things I've learned and see what gets the best results (with the least amount of effort - always watching out for typos). I should have thought of the span style system but had been told not to use it. Even if it could ever be completely phased out, though, I don't see why anyone would. It is still handy right now at least. This proves it, right?


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums