- Joined
- Feb 23, 2019
I don't think Kiwifarms' BBCode allows for HSL format (I'm not sure), but I think it's only 6-digit hex, 3-digit-hex, or the official color name, like Crimson, AliceBlue, Chocolate, DarkSeaGreen, etc.I don't want to do it so you have to: Can you re-write it to use HSL instead of RGB?
But if you want to make it for HTML span tags, then it's far easier than the RGB format, because all you need to do is cycle through 360 degrees/values for the input's length. And because it's a rainbow, saturation is always 100%, and lighting is always 50% (for a true rainbow at maximum power).
Then this would be the code, it's super simple but for HTML, not Kiwifarms' BBCode.
Python:
import re
start = "<span style=\"color:hsl("
between = ", 100%, 50%);\">"
end = "</span>"
user_input = input("Enter your word/message:\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)
count = 0
user_input_index = 0
adjust = 360 / user_input_no_space_length
hue = 1
hue_track = hue
while count < user_input_length:
space_char = bool(re.search(r"[\s]", user_input[user_input_index]))
if space_char:
print(" ", end="")
user_input_index += 1
count += 1
continue
print(f"{start}{hue}{between}{user_input[user_input_index]}{end}", end="")
user_input_index += 1
hue_track += adjust
hue_add = round(hue_track)
hue = hue_add
count += 1
Right now I'm not sure how to make a pastel rainbow in RGB so that it can be used in Kiwifarms, but if it's for HTML, while using the HSL format then it's pretty easy.how do you make it pastel![]()
Pastel is generally less saturated and "whiter", so this means that in the code above, if you change the 100% (which is for saturation) to like 60%, and then the 50% (which is for lightness) to like 85%, it will give you a more pastel rainbow, like the first half in this image:

Again, this is very easy to do in HTML, for Kiwifarms' RGB format, some adjustments would need to be done to up every channel so that the result is whiter and less saturated.