Login Register


[Golfing] Rainbow Text! filter_list
Author
Message
[Golfing] Rainbow Text! #1
[Image: JzZCj.png]

The input will be a string that contains only printable ASCII characters. The first or last characters will never be spaces, and there will never be two spaces in a row. It will always be at least two characters long.

Your output should be the same string, converted to rainbow colors as will be described below. The output may be in image form (saved to a file or somehow otherwise made available), or it may simply display the result on the screen.

(Copied from Stack overflow).

The String:
Code:
Oni is a gayass weeaboo but we love him

Log it to the command line in color, put it in canvas, or in div tags. It's free reign. Scores will be calculated on the amount of bytes used. https://mothereff.in/byte-counter is used to count the bytes.

May the best 'bow win.

THE CACHE: You're only allowed to use one module/import. (Basic modules such as system, etc from languages such as C do not count). You obviously cannot use a module which makes rainbow text for you.

Scoreboard:

@"Stocking" - 159 Bytes (32 Bytes for import)

Reply

RE: [Golfing] Rainbow Text! #2
Rainbow in what exactly? HTML? Or something else? My friends and I wrote a bot that did rainbow text for a chat site once, but they used their own sort of tagserver, and not HTML.
[Image: BXqGARG.png]

Reply

RE: [Golfing] Rainbow Text! #3
(08-22-2015, 05:04 PM)Stocking Wrote: Rainbow in what exactly? HTML? Or something else? My friends and I wrote a bot that did rainbow text for a chat site once, but they used their own sort of tagserver, and not HTML.

Log it to the command line in color, put it in canvas, or in div tags. It's free reign. (Updated OP)

Reply

RE: [Golfing] Rainbow Text! #4
159 bytes (unless you count the calling of the function).

Code:
def r(t): return "".join(["<span style='color:#%s'>%s</span>"%("".join(["%02X"%(int(f*255+.5)) for f in hsv_to_rgb(i/len(t),1,1)]),c) for i,c in enumerate(t)])

[Image: 1fVXszX.png]

[Image: VlMQ8Yn.png]

@lux I completely forgot, you need to import hsv_to_rgb for this to work.

Code:
from colorsys import hsv_to_rgb;

Just add it to the byte count. (Can't be asked to check how many bytes it is)
(This post was last modified: 08-22-2015, 06:31 PM by Equinox.)
[Image: BXqGARG.png]

Reply







Users browsing this thread: