Howdy, Stranger!

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

Is there any way to change the color of passages in the editor?

Howdy! I'm working with a team on a really large story project using twine. It would make collaborating SO much easier if it were possible to change the color of a passage in the twine editor to mark whether a passage is done or not, or if it has been edited, etc. Is this possible? I've spent a lot of time on google and all I can find is CSS styling for the build.
I'm comfortable with coding if it's possible to access it that way.

Comments

  • There is no in-built configuration to change the colour(s) of normal passages shown on the Passage Map.

    But Twine 1 is open source, it is written in Python 2.x and and the source code can be found here. There are other people that run customized versions of the application.
  • Thank you! I'll look into that.  :)
  • This doesn't change the color, but in Twine 1 tags can also help keep the passages organized like so: undefined
  • Somewhat related to dacharya64's idea.  If you write a story format support file (in python), or modify the existing one if the story format already has one (it'll be within the format's directory as {format_name}.py), then you could use tags to change the color of the tagged passages.

    Something like the following should work:

    import os, os.path, header
    class Header (header.Header):
    def passageTitleColor(self, passage):
    """
    Returns a tuple pair of colors for the given passage (normal mode color, Flat Design mode color).
    Colors may either be: HTML hex strings (e.g. "#555753") or RGB triples (e.g. (85, 87, 83)).
    You'll probably want to prioritize your conditions from highest to lowest.
    """
    if ('done' in passage.tags):
    return ('#4ca333', '#4bdb24')
    elif ('edited' in passage.tags):
    return ((80, 106, 26), (134, 178, 44))

    # Required to properly color passages if you don't match a tag above
    return super(Header, self).passageTitleColor(passage)

    Obviously, you'd want to customize the tag names and colors.

    PS: If the story format already has a support file, then just add the passageTitleColor() method above, if doesn't already have one, or your conditions to its own, if it does.
Sign In or Register to comment.