Color3: Difference between revisions
From Goodblox Wiki
Jump to navigationJump to search
Pizzaboxer (talk | contribs) (Created page with "{{CatUp|Properties}} Color3 is a variable used to store the numeric values of a certain colour. It appears in the format (R;G;B); where R is the red component (from 0-255), G...") |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{CatUp| | {{CatUp|Data Types}} | ||
Color3 is a | Color3 is a data type used to store the numeric values of a certain colour. It appears in the format (R;G;B); where R is the red component (from 0-1), G is the green component (from 0-1) and B is the blue component (from 0-1). | ||
[[Category: | |||
'''Examples:''' | |||
<pre style="color: red"> Color3.new(1, 0, 0)</pre> | |||
<pre style="color: green"> Color3.new(0, 1, 0)</pre> | |||
<pre style="color: blue"> Color3.new(0, 0, 1)</pre> | |||
If you want to use R/G/B from 0-255 instead of 0-1, then you have to divide each value by 255. You can make a function like this: | |||
<nowiki>local function color(r, g, b) | |||
return Color3.new(r/255, g/255, b/255) | |||
end</nowiki> | |||
<pre style="color: red"> color(255, 0, 0)</pre> | |||
[[Category:Data Types]] |
Latest revision as of 13:24, 20 September 2021
Color3 is a data type used to store the numeric values of a certain colour. It appears in the format (R;G;B); where R is the red component (from 0-1), G is the green component (from 0-1) and B is the blue component (from 0-1).
Examples:
Color3.new(1, 0, 0)
Color3.new(0, 1, 0)
Color3.new(0, 0, 1)
If you want to use R/G/B from 0-255 instead of 0-1, then you have to divide each value by 255. You can make a function like this:
local function color(r, g, b) return Color3.new(r/255, g/255, b/255) end
color(255, 0, 0)