Rainbowonify your Kiwifarms posts! - Rainbows!!!

We Are The Witches

True & Honest Fan
kiwifarms.net
Joined
Feb 23, 2019
I've made a newbie Python script that allows someone to convert a string of text into BBCode for Kiwifarms, which will make the string as a rainbow/gradient if posted on here, supposedly from start to finish (so only one rainbow).

These are some examples:

Hello! My name is We Are The Witches!!!!

Short

The blue is a bit hard to see with the current grey background, but that's the nature of the rainbow.

What a rainbowy sentence this is, I wonder if today is going to rain, so that maybe I can see more rainbows, all that would be left is the bows!


You don't need Python, you can just go to an online tool like this (Python online or whichever one you like) and paste the code in there. Without touching anything in the code, you can just "Run" the script and it will ask you for a sentence/word, type it in and press enter.

Once it finishes, you can click the "Copy to Clipboard" just below the "Run" button, and the output will be copied for you to paste on here (it's also going to copy your input at the beginning and "Process exited, etc" at the end, you can just delete that once pasted).

Python:
import re

#############[EDIT]############# correct offset at your liking----------------------------------------------(Edit as wanted)
# 0 >>> starts with red
# 1 >>> starts with blue
# 2 >>> starts with green
offset = 0

#############[EDIT]############# which type of string you want----------------------------------------------(Edit as wanted)
# 1 >>> for HTML
# 2 >>> for Kiwifarms' BBCode
choice = 2

# for Kiwifarms' BBCode
len_per_char = len("[color=#rgb]x[/color]")
# for HTML
len_per_char_html = len('<span style="color:#rgb;">x</span>')

if choice == 1:
  # HTML
  start = "<span style=\"color:#"
  between = ";\">"
  end = "</span>"
else:
  # Kiwifarms' BBCode
  start = "[color=#"
  between = "]"
  end = "[/color]"

user_input = input("Enter your word/message (recommended length of 6-90):\n")
user_input_length = len(user_input)
user_input_no_space = ""

for x in user_input:
  is_space = bool(re.search(r"[\s]", x))
  if is_space:
    continue
  user_input_no_space += x

user_input_no_space_length = len(user_input_no_space)

# put rgb on a wheel
offset_correct_overflow = offset % 3
rainbow_cycle = 6
# six cycles (of 16), where each end overlaps with the next one
rainbow_combinations_short_hex = (16 * rainbow_cycle) - rainbow_cycle
third_fraction_value = rainbow_combinations_short_hex // 3
step = third_fraction_value // 2

# makes sure the offset does not map anything at 3 or higher
def offset_correct(value, offset):
  value += offset
  if value >= 3:
    value -= 3
  return value

# depending on the offset, they're at 0, 1, or 2 on the wheel
# on a clock, 0 is 12, 1 is 4, 2 is 8
r_wheelmap = offset_correct(0, offset_correct_overflow)
g_wheelmap = offset_correct(1, offset_correct_overflow)
b_wheelmap = offset_correct(2, offset_correct_overflow)

# puts the (0, 1, 2) mapped values into the wheel (that has 1 -to- total combinations) values
def rgb_on_wheel(wheelmap, fraction):
  value = wheelmap * fraction + 1
  return value

# given their position on the wheel, they correspond to a value from the total combinations' wheel (of: index-1)
r_map = rgb_on_wheel(r_wheelmap, third_fraction_value)
g_map = rgb_on_wheel(g_wheelmap, third_fraction_value)
b_map = rgb_on_wheel(b_wheelmap, third_fraction_value)

def calculation(i, rgb, step, comb):
  # get the difference between the mapped channel on the wheel and the iterator/value on the wheel
  difference = abs(rgb - i)
  # however, if it's higher than half & because it's a circle and not a line, recalculates the "shorter" difference path through the other side
  if difference > comb / 2:
    difference = (comb - i) + rgb

  # now if it's not higher than a step, it's always at max vale (f) (else statement)
  # if it's higher than a step, but higher/equal than a double step, it's too far way so it's at min value (0) (first if statement)
  # if it's higher than a step, but lower than a double step, it's a gradient of values that need to be calculated
  if difference > step:
    if difference >= step + step:
      value = hex(0)[2:]
    else:
      # difference goes from 16-29 (which needs to translate to 1-14; 0 and 15 (0 and f) are already covered in other statements)
      # so it means that the difference needs to be recalculated by sustracting a whole step
      rec_diff = difference - step
      value = hex(15 - rec_diff)[2:]
  else:
    value = hex(15)[2:]
  return value

count = 0
user_input_index = 0
# wheel starts from this, before spinning
value_on_wheel = 1
value_on_wheel_float = value_on_wheel

adjust = rainbow_combinations_short_hex / user_input_no_space_length # user_input_length

while count < user_input_length:

  space_char = bool(re.search(r"[\s]", user_input[user_input_index]))
  if space_char:
    print(f"{start}000{between}{user_input[user_input_index]}{end}", end="")
    user_input_index += 1
    count += 1
    continue

  r = calculation(value_on_wheel, r_map, step, rainbow_combinations_short_hex)
  g = calculation(value_on_wheel, g_map, step, rainbow_combinations_short_hex)
  b = calculation(value_on_wheel, b_map, step, rainbow_combinations_short_hex)

  print(f"{start}{r}{g}{b}{between}{user_input[user_input_index]}{end}", end="")
  user_input_index += 1

  value_on_wheel_float += adjust
  value_on_wheel_adjusted = round(value_on_wheel_float)

  if value_on_wheel >= rainbow_combinations_short_hex:
    value_on_wheel = 1
  else:
    value_on_wheel = value_on_wheel_adjusted

  count += 1


Someone may have noticed that you can also use it to generate HTML span tags with inline CSS, so you could make stuff like this (it obviously doesn't use JavaScript or advanced CSS, it's just basic CSS):
capcap.png

By the way, this is no expert syntax or anything, I'm sure there are ways to massively improve the code, and this is using the minimum amount of complexity from the Python language (barring maybe one line with RegEx). You're invited to improve this stuff and tell how you could have made it better.

If you're interested in what concept it tries to put into practice to achieve the result, is firstly by assuming that the color-codes will be on the 3-digit Hex format, with maximum saturation and lighting by only going through the (red, yellow, green, cyan, blue, magenta) channels, so that it achieves a rainbow (so no white, black, grays, or combinations of that).
The wheel that it simulates:
rainbowwheel3hex.png
 
Pride month is already over. But hey, with monkey pox on the rise again, maybe we can still get some mileage out of it.
That reminds me of a Ralphie May stand-up.

The joke was that rainbows don't have to belong to gay people, you can be whatever and enjoy the amazing colours. I'll let him do the work:
 
I simplified the posted version and added some parameters to the program:

Python:
#/usr/bin/env python3
# Python version should be greater than 3.10

## PARAMETERS ## ----------------------------------

## Color offset (Decimal value in range [0-inf))
# 0.0 >>> starts with red
# 1.0 >>> starts with blue
# 2.0 >>> starts with green
offset = 0

## Type of output string (Integer, must be of below)
# 1 >>> for HTML
# 2 >>> for Kiwifarms' BBCode
choice = 2

## The number of characters until the color repeats (Natural number)
# 0 >>> Cycle matches length of text
color_cycle = 48

## Whether to skip whitespace for advancing the cycling of color during computation (Boolean, or True/False)
# True >>>> Whitespace advances color cycle
# False >>> Whitespace does not advance color cycle
skip_color_whitespace = False

## Whether to use wide hex (6 characters) or short hex (3 characters) (Boolean, or True/False)
## Wide hex allows greater color range at the expense of increased characters used
# False >>> Short hex, e.g. `#FFF`
# True >>>> Wide hex, e.g. `#FFFFFF`
use_wide_hex = False


## ------------------------------------------------

# check version
import sys
if sys.version_info[0] < 3 and sys.version_info[1] < 10:
    print("match-case requires python version > 3.10")
    sys.exit(1)

import re
import math

# simple piecewise hsv rotation function
def deg2rgb_LinearPiecewise(deg):
    pdeg = deg / 60.0
    i = int(pdeg)
    ff = pdeg - math.floor(pdeg)

    match i:
        case 0:
            rgb = (1.0, ff, 0.0)
        case 1:
            rgb = (1.0 - ff, 1.0, 0.0)
        case 2:
            rgb = (0.0, 1.0, ff)
        case 3:
            rgb = (0.0, 1.0 - ff, 1.0)
        case 4:
            rgb = (ff, 0.0, 1.0)
        case 5:
            rgb = (1.0, 0.0, 1.0 - ff)
    return rgb

def rgb2shortHexStr(rgb):
    r = int(rgb[0] * 15)
    g = int(rgb[1] * 15)
    b = int(rgb[2] * 15)
    return f"{r:01x}{g:01x}{b:01x}"

def rgb2hexStr(rgb):
    r = int(rgb[0] * 255)
    g = int(rgb[1] * 255)
    b = int(rgb[2] * 255)
    return f"{r:02x}{g:02x}{b:02x}"


# __main__

match choice:
    case 1:
        # HTML
        fmt_str = "<span style=\"color:{0};\">{1}</span>"
    case 2:
        # Kiwifarms' BBCode
        fmt_str = "[color=#{0}]{1}[/color]"

user_input = input("Enter your word/message:\n")
user_input_length = len(user_input)

ws_regex = re.compile(r"(\s+)")
split_text = ws_regex.split(user_input)

if skip_color_whitespace:
    ws_match = ws_regex.search(user_input)
    if ws_match is not None:
        for ws_span in ws_match.groups():
            user_input_length -= len(ws_span)

deg = 120.0 * float(offset)
deg_step = (360.0 / user_input_length) if (color_cycle == 0) else (360.0 / color_cycle)
for text_segment in split_text:
    if len(text_segment) == 0:  # account for regex split with beginning matches yielding empty strings
        continue
    if ws_regex.match(text_segment[0]) is not None:  # matched whitespace segment
        print(text_segment, end='')
        if not skip_color_whitespace:
            deg *= deg_step * len(text_segment)
            deg %= 360.0
    else:  # found pure segment of symbols
        for ch in text_segment:
            # get hex
            if use_wide_hex:
                hexstr = rgb2hexStr(deg2rgb_LinearPiecewise(deg))
            else:
                hexstr = rgb2shortHexStr(deg2rgb_LinearPiecewise(deg))
            # advance hue angle
            deg += deg_step
            deg %= 360.0

            print(fmt_str.format(hexstr,ch), end='')





















 
Ṕ̵̨̧̨̢̢̡̛̗̙̰̣̻̳͓̱̳̟͔͇̙͓͎̫̲̝̗̫̳̣̮̳͕͍̞͉͈͔̪̳͈̠͎̭̘̯̝̞̗̥̫̼̩̘̤͙̻̤̲͍̇̈́͒̓͊̊̏͒̄͑͊̉͐̐̋̑̓̈́̈́́̏̎͛̈́̉͑̈̍̈͂̇̄͒̍̉̐͒̿̇̋̈́̓̉́̂̉͗̒͂̌̀̌̑̍̏́̾͆̈́͊̚̕̚̕͜͜͜͜͠͝͝͠͝ë̸̛̘͔͚͈̙̯̘̝̙̱́͒͐̓̐͗́̔̃̆͒̏̃̉̋̓̓̔͆̏̾̇͛̑̆̀͋̋̾́̾̈́͆͗̒̌̓͘͘͝n̸̢̨̧̡̧̨̡̢̢̡̡̡̧̛̬̹̗̩͍̝̘͙̟̩̹͖̖̪͙̼̺̯̗̳͓͔͕̖̟̠̗̯̠̤͓̺͙̥͍̮̭̦̱̦̞̲̬̬̰͕̙̫͕͎͙̪̝̖͈͈̲͙͓̺̥̪͓͔̣̤̱̬̟͉̗̤̭̱̼̰̣̰̞̣͉̩͕̱̙̫͔͕̩͍͖͎͓̦̩̬̪̼̊̄̒̄͑̽̕̚͜͜͜͜͜͜͜͝ͅͅi̴̧̧̢̛̛̞̟̠̩̲͕̼̤̘̼͎̣̲͇̻͉̜̥̠̥̪̥͈̟͇̻̱̙͚͂͒̓̍̈́̋͌̈͌̅́̈̍̓̀́͋͛͆̒̔̌͑͗̒̄̂͋̅̈́͌̓͐̃͆̉̊̀̇́̔͂̿͋͌͊̑͐̈̃̃͊̑̊̀̃̂̔̎̓̊̒͊͂̕͘̕̚̕̕̕̕̕͝͝͝s̵̢̢̧̢̧̢̨̛̫̖̠̦͉̫͓̝̮̯̪̦̱̭̫͎̹̺͓̺̭͔̙̟͔̺̟̭͎̱̩̩̗̺͎̝̤̫̫̻̣̝̳̤͉̞͔̹̥̮̬̳̳͎̟̑̈́̀̍̔̿̒̆̒͆̓̈́́̑̆̈́͂̀͗̎͐͋͋͘̚͘͜͜͜͠ͅͅ ̶̢̛̬̺̹͚̤̞̣̗̤̳̙̟̬̣̼̲̝̣̦͓͍̹̰͔͓̥͉̜͈̩̺̗̱͚̻̘̤̹̲̪̱̦̌̈́̉͒̎̽͂̔͛͗͒͊̒͐̈́̌̃̈́́̓͋̄̾̀̃̂̽͒̔̔̽̋̊̇̍̓͌́̑͆̊̑̊͛̓̔̇̾̄͛̓́͊̄̂̎̆̆͆́͆͆̋̂̌͘̚̚̕̕͘̕͘͜͜͠͝͝͝͝͝ͅͅP̸̢̧̨̢̢̢̡̢̡̡̲̦̬̝͎͉͕̤̻̟͓̞̫̱͎̤̝͙͔̦͇̯̯͙͙̞̲͓̱͍̠̙̖̣͓̖̯͚̫̪͖͓͇̬̯̭̺͈͈͕͔̼͙̱̝̺̼̱̦͙͈̼͉̰̻̳̲̟̞̥͖̱̱̘͖̜̦̹̰͕͖̖̞̪͔͈̳͓̬̪͕̤̗̲͚͓̱̪̮̻͍̪̟͕̬̄̄͐̓̇̂̈́͐̿͐͑̾̂͂̃̾̿͑̅̾͌́͗̚͜͜͜͝͝͠ȅ̷̢̡̡̢̢̨̨̡̛̛͍̰͕̙͚̖̟͙̝̼͔͔̜̺̯͚̰͕̮̟̩̳͕͖̬͙̱̤̣̬̮̞̳̩͉̖̤̜̻̻͎̜̺̭̘̟̫̗͎̞̥͕̺̩̪͈͎̯͈͉͉̺̲͎̜̳̳̙̜̳̗̼̘̳̯̭̯͙̮̦̼͓̪̊̽́̈́̏́́̌̏̎́̎̉̾̎̎̓̇́̎̆̋͋́̆͐͂̾͊̏͑͐̇̉́̅̀̌̆͆͆̆̎̀̌̔̋̐̑̽̅́̇̓̂̅͗̀͆́̂͐͒͋̊̄̀̈̊̈́͑͋̐̊͌̄̊̀͂̊́̏̆̔̓̒̃̈́̆͐͑͊́̾̾̄̆̂̈́̉͗̂̀̾̆̆̀̑̅̔̚̕͘͘͘̚̚̚͜͜͝͠͝͝͝͝͝͝͠ͅͅͅͅņ̸̛̛̛̛͍̤̰͚͔̜̰̙̺͙͍̣̯̣͕̣͚̀̔͛̃̎̊͌͊̅̄́̈́̂͐̔͒͋̽̅͛̓͊̅̎͗̈́̎͆̉̅̋̔͌̚̕̕͘͝͝i̵̢̗̙̺͎̲͓͈̾̎̿̊͋̽̽͛́̀̾̔̂͛͋̔͌͂̃̂̄̒̍͛̋̑̌̀̊̊̍̔̊͊̄̉͐́͆̄̀̔̓̍͋͌͊̿̍̍̍̎̑̓̏̽̑̉̾̒͋̓͌͌̉͂̈́̈́́͛̔̓̀̈́̔̆͌̀̽̆̃͂̃̏͐̿̏̓́̓̋͋̌͐̆̽̽͂̃̚͘̚̕̕͘̚̕̚͝͠͝͝͠͝͝͝ś̴̡̮͉̪͔͎͇͙̌̓̋͐͗̋̆̿̏͆̿͐̽͒͛̔̈͊̃̇̏̈̐͗̓̿͊͛̌̈́̓̈́͑̍̾̾̂̂͑͊̇́͑̽̈̂͆͑̓̆̆̓͑̊͗̿̃͛̀̈̌̀͌̓͌͑́̾͐̾̐̐̆̒̑̎͊͋́̓̀̓̂́͘̕̕̕̕̚̚͝͝͝͝͝͠P̷̡̧̧̡̡̨̡̨̡̢̺̥̣̳͍̠̫̣̱̭̱̜̼̩̺͍͓̬͓̫̟̤̯̯̝̗̠̼̭̤͎͚̥̙̹̤̜̺͕̪̟͎̻̳̙̪͖̦̪̫̹̙̣̮̫̪͎͇̜̜̻̤̬͈͔̩͔̖̳̮̤̰͉̫̦̳̜̺̱̲̜̲̱̳͈̫̝̬͉̹̣͇̮̪͙͕͍̖͕̲̬̪̭̦͗̿͜͜͜ͅè̶̯̖̝̿̒́͘̚̕ͅņ̸̡̧̡̧̨̨̢̢̨̛͉̪̗̟̬̹̪̙̞͓͖̳͎̳̲̣̭̖̬̖̺͔̻̪̜̞͉͇̭̣̮̜̫̻͎̮̭͍̱͚̞̳̠̟̙͙͇̰̦̰̯͕̯̞͙̞̤̫̣̗̰̖͍̝̙̗͕̠͓̮̜̺̮̲͈̦̲̫̤̗̻̳͙͎̮̙̟̬̩̼̗̯̭͇̱͕̘̣̭̥̯̳̖͎̍̐̽̃̑̂̎͑̏̀͂͌̔̈͑͛̌͊̅͐̓̈́̃̿̏̇̾͗́́̑̑̈́͋̔̑̒̽̿̊̍̈́̍͛̀̍̍̉̓̉̃̌̈́̊̀̄̓̌̚͘͘͜͜͜͝͝͝͠ͅi̸̢̢̡̢̡̧̨̟͍̘͖̟̗̫͈̫̰̬͕̬̼̮̪͕͍̬̯͕̖̳͈͇̗̮̞͉̝̲͔̝̙̟̗̮͎͓̜̬͈̭͍̪̤̲̖̳̩̺̗͔̘͓͉̙̟̍̐̆̈́̏͂̑̌͆̉͗͆͋͂͐̄̓̓͊̐́̎̑͑̊͑͂̈̎̆̎̊̏̇̽͗̎̂̽̈́̑͐̒̿̕̚͜͝͝ͅͅs̴̨̧̨̢̪̘̟̝̪̖̗̦̗̺̘̗̳͓̼̜͈̖̜̮̘͇̩̥͚̞̫͇̳̤͎̬͈̩͙̼̮͔͔̳̫̞̹͔̹̩̺̼͆̇̿̍̿̓̇̿́̂͐͗̍̈́̏͊̽̎́̉̃̒̀̓͌̽͌͆̆̽̂̂͌̿̀̃͂̃̔̇̀̀̈́́̃̈́̓̓͆̕̚͘̚̕͜͜͝͝͝͝͠͝ ̴̢̢̡̼͇̫̩͚͇̠̦̘͈̻̪̟̙͈̖̻̼͇͚̯̟͍̠̣̻̦͙͕̱̪̹́̌̍̓͗̓̂̑̿͌̉̓̃̍̿̓̅̄̃͊̇̄̀͌͛̒̆̇͒͊̿́͒̓̽̇̊̽̆͑͛̈̏͗͊͊̇͗̽͌͆̾̒̊̒́̈́̀̓͌̅̌̉̾̽̀̅̐̍̈́͐̃̕̚͘͘͘̚̚͘̕̚͜͜͜͜͝͝͝͝͠͠͝͠͠ͅP̷̨̛͎͇̼̫̩͚̩̱͎̦̬̭͍͚̻̑̌̏̑̽̄́̾̆̔̏̓̔̿̉̈́͒̀̇͆̀̈́͒̽͋̑̓̂̊̂̈̓̓͌͆̒̾̉̾͂̎̍̍̃͛̉̎͗͊̄͌̀̎̈́̍̓͗̉̾̽̇́͆́̏͂̔̑̎͑̾͂͘̕̚͘̕͘̕̚̚̚̚̕͝͝͝͝͝͝͝͝͝ȩ̵̨̧̢̛̛̛̯͇̺̣̯̹̣͚̗̺̜̦̩̰͓̯̲͓͔͍̫̖̮̞̫̼͔̥͚̖̬͎͔̫͕͈̝̲̞̝̜̬̮̫̠̞͚̰̹͓̰̥̪͎̳͈̞͇̘̱͈̯͙̳̖͓̠̲͓͚̗̺̘̗̦̖̩̗̣̖̙̤̦̯̻̍̎̎̉̽̆̏̎̌̈̂̏̑̌͊̂̅̐̿̎̇̅̀̿͋̀͑̔̽̈́͐̋̓̀̉̊͌̉͂͌̽͂̅̔̆̓̎̈̃̇̎̐̏̿̓̊̽͋̃̄͗̈̌̀̏͑̄̏̍̾̑͒̄͒̆͂͊́̿́̅̈̒̑̀́̂̉̾̔̅̊́̍̾̂̉̇̓͊͌̊̔̈́̋̌̉͘̚͘̕͘͜͜͜͝͝͝͝͠͝͠͝͝͝͝͝͝ͅͅͅi̸̢̨̨̢̧̨̧̨̨̡̧̧̨̨̨̡̢̛̱̘̻͚̫̠̺͇̥̗͚̳̯̜̺̖̬͚̤̥͖̟͈̞̭̮̲̱̘̲̭̤̫͍̹̞͓̙̳̻̥̲͎̮̞̤̳͔̜͔͍͚̥̟̺̯̦͓͓͍̙͈̣̟̥͉͓̩͖̺͙̝͖͉͙͇̲̻̹͙̫̭̮̤͚̲̬̰̦̫̞̦̝͎̰̗̘̯̻̲̜̺͎͔̦̊͒͊̅̓̔̔́̀͆́́̒̏̑́͗́̌̎̐̿͒͂̂͂͑̅̅̌̋̀̿̓̀̅̌͊͗̂̈́̈̄̉̐̾̈̍̿̊͌͋̌̽̿̒̈́̑͋̏͗̾̀͋̌̀̒̀̀̈́̈̓̐̓̈́̃̄͊̕̕̚͘̕͜͜͜͜͠͠͝͝͝͝͝ͅͅͅͅś̵̡̡̢̡̧̢̧̢̡̧̢̛̛̺̜̲͈̱̞̪̱̖͔͙͇̩̖̳̬̞̩̘͕̯̹̲̱̙̤̺̠͙͔͎̗̩̻͔̗̝̦͉̱̙̦̭̺̭̗͓̻͔̖̯̘͍̻̖̤͚̭̯̼̹͚̭̬̞͔̫̘͔̯͉͚̟͖̘̠͙̙͉̹͓̤̻͓͓̺̠̣̮͓̺̳͍̱̬̗͙̺̭͔͔̬̼̩̤̺̈̿̓̇̀̏̿͛͛̋̿̂́̾̄̒̒̂̎̑͒̌͒̂̆̓̇͂͋̀͂̈͗̐͗͛̈̅̓͛̒̎̍͋͐̃̑̔̐̽̋̎̄͗̑̎̊̊͌͛̃͂̆̀̚̕̕͘͜͜͜͠͝͝͝͝ͅ ̶̧̨̢̨̧̧̼͕̗̟͔̫̼̤̝̖̹͔̺̬̞̺̻̬̥̘̘̖̺̱̭̱͍̰̭̗͎̗̙͍̘̳̮̘̗͉͂͗͐̍͊̒̅̓̑̆̔̀̋̀̈́͌̏̈̐̂͂̅̉́͂͒̈̇̆̾͆̾̔̽̿͗͛̿̎̈́́͐́͂̆͘̚̚͘̕͜͝ͅP̵̨̢̧̠̖̺̤̮̘̼̤̯̬̲͇̩̫̰͖̝͚̟̾͋̍̐̅̋̓͊e̵̛̛̘̳̬̿̏͂̿͊͋̅͒̌̉̅̀̿̈́̎́̈́͌̏͋͂̇̔̂͋̊̉̓̿̉̽́̈́̉̌̆̀͆̐͊͐̑̎͌̀͐͌̈́̈́̈̊͆̌͑̔̊̃̔̓͗̄̉̑̾̈́̑͐̊̀̍͊͆̄́͛͌̾̿̒̑̓̉̍̇́̄́̚͘̚̚͘̚͘̚͘͝͝͠͠͝͠͠n̵̨̡̨̨̧̡̛̛̛̬̺͈̟̜̦̮͎̰͚̫̦͕̜̻͙͎͇̗̹͙͍̘̼̤͇͎͓̲̝̭̳̫͈͕̥͇͍̙͕̰̹͕̺͈̫̹̲͎̬̮̟̦̞͓̔̔͗̀͛̈́͂̑̀̊́͐̉͛̈́͛̌̾̀̽̓͐͊̍̐̈́̂̎̏̇́́̏̈̊̊͗̐̀͒̏͗̿̈̋̀͗́̃̈́̑̓̏͌͑̈́͆̇̀͋̔̒̉̎͑̍̇̆̍̀̊̂̂͌́̕͘͘̕̕͜͝͝͝͠͠͝͝ͅị̴̧̲̿̊̉̂͊̈͗̒̊̚ͅs̸̡̡̨̧̨̢̨̢̢̨̨̗̣̹̝̯̬̺̼̜̼͖̰͔̦̭͍̲͕̙͕̳͖͓̱̞̤̹̭̠̖̫͈̞̲̼̭̗͈̲̩̖͔̫̹͇͉̠̟͓̮̞͓̼̯̙̺̮̜͙̦̣̳̣̱͙̦̟̭̪̯͖̙̣̻̪̣̳̝̟̦̘̳̥͈̘̱̤̮͍͍̹̯̙̻̫̦͔͉̟͖͉͛̿̏́͋̄̎̎̓͒̍́͑̎̿̄̾̉̅̐͑̒̔̉̍̽̇̀̏̄́̒̈́̍̀͂̃̌́̉͐͒̑̑̕̚͜͠͠ͅ
 
I simplified the posted version and added some parameters to the program:
Nice, that is greatly improved, looks like your approach was slightly different than mine with calculating the degree (I was just calculating how far away was the value in the cycle from the RGB channel).

It's something it occured to me at first to do it like this so I went with it.

Looks like you missed the "#" for the generation of the span tags' color property value (handled by the "fmt_str").
 
Back