0 votes
asked by (2.4k points)
closed by
I just asked a question asking how to change the color of a normal word, but what about links?

Is it even possible? I don't want to change them all, just one.
closed with the note: Got my answer.

1 Answer

+1 vote
answered by (131k points)
selected by
 
Best answer

Ideally it should be as easy as using the (text-colour:) / (colour:) macro to change the colour of a (link:) macro like so...

(color: red + white)[
	(link: "Wyannie Malone Historical Museum")[
		(go-to: "Next")
	]
]


... however Harlowe 2.x applies default CSS like the following directly to it's links...

tw-link, .enchantment-link {
	color: #4169E1;
	font-weight: bold;
	text-decoration: none;
	transition: color 0.2s ease-in-out;
}

...which interferes with how the (text-colour:) macro applies it's colour.


You can get around this issue by adding CSS like the following to your project's Story Stylesheet area, it forces the (link:) macro used in my first example to inherit the colour supplied in the related (colour:) macro and should only effect (link:) macros that are within the said (colour:) macro.

tw-expression[name="color"] + tw-hook tw-link {
	color: inherit;
}

 

commented by (2.4k points)
You're the best man :)
commented by (430 points)
edited by

This isn't working for mine. I copy-pasted the CSS to my stylesheet, but this...

$Co1[(link: "Commander")[(set: $Sect_1 to 1)(goto: "About the Sects")]]
$Co2[(link: "Analyst")[(set: $Sect_1 to 2)(goto: "About the Sects")]]
$Co3[(link: "Medic")[(set: $Sect_1 to 3)(goto: "About the Sects")]]
$Co4[(link: "Communicator")[(set: $Sect_1 to 4)(goto: "About the Sects")]]
$Co5[(link: "Navigator")[(set: $Sect_1 to 5)(goto: "About the Sects")]]
$Co6[(link: "Technician")[(set: $Sect_1 to 6)(goto: "About the Sects")]]
$Co7[(link: "Scout")[(set: $Sect_1 to 7)(goto: "About the Sects")]]
$Co8[(link: "Researcher")[(set: $Sect_1 to 8)(goto: "About the Sects")]]
$Co9[(link: "Engineer")[(set: $Sect_1 to 9)(goto: "About the Sects")]]
$Co10[(link: "Soldier")[(set: $Sect_1 to 10)(goto: "About the Sects")]]

...is still producing the default blue links. And yes, all of my $Co# variables are (set:) and working; not only are they showing the appropriate colors in any text passages, but when I click the Debug View button when testing, the [[brackets]] that show up around each link are the appropriate color for each Sect.

I didn't have this problem with the last version I did of this particular project, but that was because I was using (click:) macros instead of (link:) macros. :(

 

(...please don't make me have to make a duplicate thread for this when logically this one should be fine...)

commented by (2.4k points)
Oh....god, I'm not sure what to do sorry.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...