Skip to content

Instantly share code, notes, and snippets.

@hanneshapke
Created April 11, 2018 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanneshapke/44e6f17341b71955114b7c2040be8622 to your computer and use it in GitHub Desktop.
Save hanneshapke/44e6f17341b71955114b7c2040be8622 to your computer and use it in GitHub Desktop.
Generate the text tag with the color attribute
def cstr(s, color='black'):
return "<text style=\"color:{}\">{}</text>".format(color, s)
@tarsil
Copy link

tarsil commented Mar 5, 2019

That's very nice and clean way but I would advise you just to beach the s as you can easily have an XSS attack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment