Guest User

avncolor12.py

a guest
Jan 4th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.70 KB | None | 0 0
  1. # Ecrire en couleurs aléatoire sur avenoel.org
  2.  
  3. # Installez python 3
  4.  
  5. # Ouvrez le programme avec IDLE
  6.  
  7. # appuyez sur F5
  8.  
  9. # tapez randcolor() pour avoir des couleurs random
  10.  
  11. # tapez randcolor(1) pour avoir des couleurs random ET italique, gras, souligné, et barré random
  12.  
  13. # tapez arcenciel() pour avoir un texte en arc en ciel avec des couleurs moches
  14.  
  15. # tapez arcenciel([c1, c2, c3, ...]) pour changer le set de couleurs, en hexadécimal (de la forme 0xFFFFFF)
  16.  
  17. # rentrez une chaine de caractère pour avoir la chaine avec les tags, puis copiez la chaine.
  18.  
  19. # tapez /quit pour sortir
  20.  
  21. # tapez sur CTRL + C pour arreter le programme
  22.  
  23. # By Encephallus
  24.  
  25. # Code cancer osef
  26.  
  27. from random import randrange
  28.  
  29. def randcolor(style = 0):
  30.     tab = ['i', 'b', 'u', 's']
  31.     while (1):
  32.         string = input()
  33.         if string == "/quit":
  34.             return
  35.         for i in string:
  36.             r, g, b = map(lambda x: str(hex(randrange(x))), [0xFF]*3)
  37.             balise = tab[randrange(4)]
  38.             if style:
  39.                 print("<" + o + ">", end="")
  40.             print("<color=#" + r[2:] + g[2:] + b[2:] + ">" + i + "</color>", end = "")
  41.             if style:
  42.                 print("</" + o + ">", end="")
  43.         print()
  44.  
  45. def arcenciel(couleurs = 0):
  46.     if not couleurs:
  47.         couleurs = [0xd71d00, 0xf58c1d, 0xe6ff00, 0x00ff00, 0x52d7d0, 0x0b00ff, 0x4f007d]
  48.     couleurs = list(map(lambda x: '<color=#' + str(hex(x))[2:] + '>', couleurs))
  49.     n = len(couleurs)
  50.     while (1):
  51.         string = input()
  52.         if string == "/quit":
  53.             return
  54.         for i in range(len(string)):
  55.             print(couleurs[i % n] + string[i] + '</color>', end="")
  56.         print()
Add Comment
Please, Sign In to add comment