Skip to content

New userdata: Color

dounai2333 edited this page Jan 24, 2025 · 5 revisions

Introduction

Easily manipulate colors.

local color = Color(100, 100, 100)
print(color) -- Output: "100 100 100 255"
color.r = 255
color.g = 255
color.b = 255
color.a = 128
print(color) -- Output: "255 255 255 128"

Color

Color(red, green, blue, alpha)

Creates a color. the numbers will be capped at 0 - 255.

Return: color

red: number

green: number

blue: number

alpha: number

ToColor32

color:ToColor32(negative)

Converts color to color32 style.

Example: Color(255, 255, 255, 255) will be convert to 4294967295 (-1), Color(0, 0, 0, 255) will be 4278190080 (-16777216).

Return: number

negative: bool

ToFontString

color:ToFontString()

Converts color to RGB style (#000000), losing the alpha channel. Uses to fit "<font color='{}'>".

Return: string

ToVector

color:ToVector()

Translates the color into a vector, losing the alpha channel. This will also range the values from 0 - 255 to 0 - 1.

Return: vector

Clone this wiki locally