Question about Color3 and mathematical operations

Hello!

I was wondering if there was an easier way to do this, I want to make a Color3 readable to myself to know if I’m using it properly (r,g,b • 255) but was wondering if there was an easier way to do the following:

local test = Color3.fromHSV(Color3.toHSV(Color3.fromRGB(179, 155, 255)))
print(test.R * 255, test.G * 255, test.B * 255) -- can I get rid of the 3 operations and use a single operation instead?

Better explanation here:

Can you explain what you meant by this line?

why not use Color3.fromRGB()???
do you need fromHSV???

As far as I know, Color3.fromRGB() and Color3.new() are the most easiest ways to change or to do something with colors

that’s not explaining why they need fromHSV and they complain about needing the “* 255”

1 Like

I don’t really know how.

In Vector3s, we can do

local oldvec = Vector3.new(1,1,1)
oldvec += oldvec

Is there an equivalent to doing this with Color3s?

@D0RYU - I’m giving users the option to input their own UI accent colour using hue, saturation and value (which is easier than messing with R,G and B values. I am really only asking to check my method of doing things to check if I’m using toHSV and fromHSV correctly.

I’m not complaining, I am just saying that Color3.new takes values that are equal or less than 1 whereas the standard for readability is 255 (eg. Google).

1 Like

oh ok great, that explains it, also the complain part wasn’t meant to sound rude in any way

1 Like

Only thing I would do to make it more readable is to use functions. To answer the comment from the code, no you can’t, and I don’t think there’s an equivalent to shorten the operations to Color3s.

function MultiplyColor3s(color)
	local r = color.R*255
	local g = color.G*255
	local b = color.B*255
	return r,g,b
end

local color = Color3.fromHSV(Color3.toHSV(Color3.fromRGB(179, 155, 255)))
print(MultiplyColor3s(color))
2 Likes