PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

ImageColor3

ImageLabel

Color3

The ImageColor3 property determines how an image is colorized. When set to white, no colorization occurs. This property is very useful for reusing image assets: If the source image is completely white with transparency, you can set the entire color of the image at once with this property.


Code Samples


Image Hover Lock

This code sample causes an ImageLabel/ImageButton to display a red padlock. When the mouse is hovered, it changes to a green unlocked padlock.

local imageLabel = script.Parent

-- The images in this example are 64x64
imageLabel.Size = UDim2.new(0, 64, 0, 64)

local function unlock()
	imageLabel.Image = "rbxassetid://284402785" -- Unlocked padlock (64x64)
	imageLabel.ImageColor3 = Color3.new(0, 0.5, 0) -- Dark green
end

local function lock()
	imageLabel.Image = "rbxassetid://284402752" -- Locked padlock (64x64)
	imageLabel.ImageColor3 = Color3.new(0.5, 0, 0) -- Dark red
end

-- Connect events; our default state is locked
imageLabel.MouseEnter:Connect(unlock)
imageLabel.MouseLeave:Connect(lock)
lock()

Rainbow Image

This code sample loops an ImageLabel or ImageButton’s ImageColor3 through the entire rainbow using RunService’s RenderStepped.

local imageLabel = script.Parent

local RunService = game:GetService("RunService")

local function onRenderStep()
	imageLabel.ImageColor3 = Color3.fromHSV(workspace.DistributedGameTime/8%1, 1, 1)
end
RunService.RenderStepped:Connect(onRenderStep)