Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #!/bin/python3
  2. import sys
  3.  
  4. if len(sys.argv) < 2:
  5. l = 'sample text'
  6. else:
  7. l = sys.argv[1]
  8. print('$$', end='', sep='')
  9. c = 0
  10. colors = ['#ff0000',
  11. '#ff7f00',
  12. '#ffff00',
  13. '#00ff00',
  14. '#0000ff',
  15. '#4b0082',
  16. '#9400d3']
  17.  
  18. for x in l:
  19. if x.isspace():
  20. print('\\text{',x,'}', end='', sep='')
  21. continue
  22. c = (c+1)%7
  23. print('\color{',colors[c],'}\\text{',x,'}', end='', sep='')
  24. print('$$')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement