# Class "Color"

## Constructors

### [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) () {: aria-label='Constructors' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### void [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) ( float R, float G, float B, float A, int RO, int GO, int BO ) {: .copyable aria-label='Constructors' }

Constructor for the "Color" class.

When using the [Font](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Font/README.md) class, use [KColor()](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/KColor/README.md) instead.

Colors are made of three separate components, tint, colorize and offset. Tint acts like a color multiplicator. Offset is a color which is added after the tint is applied. Colorize is complicated. See the `:::lua SetColorize()` function for a detailed description.

R, G, B and A accept numbers between 0 and 1.

RO, GO and BO accept numbers between -255 and 255.

## Functions

### \_\_mul () {: aria-label='Functions' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) \_\_mul ( [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) right ) {: .copyable aria-label='Functions' }

Multiplication of two colors.

### Lerp () {: aria-label='Functions' }

[ ](/ab_p/beta/docs/color.md){: .static .tooltip .badge } [ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### static [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) Lerp ( [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) m1, [Color](https://github.com/wofsauge/IsaacDocs/tree/420a6aaa54ea230461fb26e61297c068492684de/beta/Color/README.md) m2, float t ) {: .copyable aria-label='Functions' }

Linear Interpolation between two colors. `:::lua t` is the "progress" of the interpolation. Setting `:::lua t = 0.5` means that the color in the middle of m1 and m2 will be returned.

### Reset () {: aria-label='Functions' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### void Reset ( ) {: .copyable aria-label='Functions' }

### SetColorize () {: aria-label='Functions' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### void SetColorize ( float Red, float Green, float Blue, float Amount ) {: .copyable aria-label='Functions' }

The colorize function can be used to change the color of sprites. Its the best for that purpose, since it doesnt affect existing coloranimations like the flashing of creep.

The values can be between 0 and 1 for normal coloration. if you use higher numbers the color gets more vibrant.

???- note "Notes" The alpha component determines how much colorization must be applied. The function takes the original color, converts it to grayscale, multiplies it by the RGB components and then blends it back with the original color. The alpha value determines the blending factor. Colorization is applied after the tint and before the offset function.

???- example "Example Code" `:::lua SetColorize(1, 1, 1, 1)` will turn the sprite into grayscale.

````
 `:::lua SetColorize(1, 0, 0, 1)` will turn it red but not as a red tint but as shades of red.


`:::lua SetColorize(1, 1, 1, 2)` will invert the sprite without touching its luminosity.



This code changes the color of red Creep to be purple
```lua 
Test:AddCallback(ModCallbacks.MC_POST_EFFECT_INIT, function(_, self)
if self.Variant == EffectVariant.CREEP_RED then
local color = Color(1, 1, 1, 1, 0, 0, 0)
color:SetColorize(4, 0, 4, 1)
self:GetSprite().Color = color
end
end)

```
````

### SetOffset () {: aria-label='Functions' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### void SetOffset ( float RedOffset, float GreenOffset, float BlueOffset ) {: .copyable aria-label='Functions' }

Offset is a color that gets added to the sprite after the Tint was applied.

### SetTint () {: aria-label='Functions' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### void SetTint ( float RedTint, float GreenTint, float BlueTint, float AlphaTint ) {: .copyable aria-label='Functions' }

Tint acts like a color multiplicator.

## Variables

### A {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float A  {: .copyable aria-label='Variables' }

### B {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float B  {: .copyable aria-label='Variables' }

### BO {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float BO  {: .copyable aria-label='Variables' }

### G {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float G  {: .copyable aria-label='Variables' }

### GO {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float GO  {: .copyable aria-label='Variables' }

### R {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float R  {: .copyable aria-label='Variables' }

### RO {: aria-label='Variables' }

[ ](/ab_p/beta/docs/color.md){: .abp .tooltip .badge }

#### float RO  {: .copyable aria-label='Variables' }


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.moddingofisaac.com/ab_p/beta/docs/color.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
