Modded Flooded Area Tools
Wire color preview
This tools previews what colors you get if you change the Signal Type to certain string, you can test this in Modded Flooded Area using the Power Manager Item.
For example if the signal type is the most common ones like Red, Green, Blue or custom strings like a, ba or HiThisIsMe
For those nerds out there, the code in lua looks like this
local function hashString(str)
local fnvPrime = 16777619
local hash = 2166136261
for i = 1, #str do
hash = bit32.bxor(hash, string.byte(str, i))
hash = (hash * fnvPrime) % 2^32
end
return hash
end
local function stringToColor(str)
if not str or str == "" then
return Color3.fromRGB(255, 234, 0)
end
local hash = hashString(str)
local hueDeg = (hash % 360)
local hue = hueDeg / 360
local sat = 0.55 + ((bit32.rshift(hash, 9) % 7) * 0.06)
if sat > 1 then sat = 1 end
local val = 0.85 + ((bit32.rshift(hash, 12) % 5) * 0.03)
if val > 1 then val = 1 end
return Color3.fromHSV(hue, sat, val)
end