Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Two Colours In One HTML Text String

edited November 1 in OpenSesame

Hi all,

I have a quick question regarding two different font colours in one line of text. Currently the script is:

draw textline center=1 color=black font_bold=no font_family=mono font_italic=no font_size=32 html=yes show_if=always text="[hint_word] - [code_word]" x=-128 y=0 z_index=0

This displays

[hint_word] - [code_word] on the screen. (The actual words are read in from an excel file).

However I need the hint_word to be black and the code_word to be a different colour. I have tried doing what many have suggested in various stack exchange posts for HTML, but I am having trouble translating that into OS.



  • Hi Liam,

    The easiest way to do this is by using a span tag around the words that you want to color, and then assign a special style to them. Like so:

    <span style=color:red;>red text</span> and <span style=color:green;>green text</span>

    This is regular HTML, but as of OpenSesame 3.2 this will work also in sketchpad items.


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • Hi Sebastiaan,

    Thank you very much! Working like a charm!

Sign In or Register to comment.