Skip to content
GhostglowDev edited this page Mar 21, 2024 · 2 revisions
local clr = require "ghostutil.color"

See source code

Color Variables

Variables for each color

Brightness Colors

  • WHITE (0xFFFFFFFF)
  • GRAY (0xFF808080)
  • BLACK (0xFF000000)

Actual Colors

  • RED (0xFFFF0000)
  • BLUE (0xFF0000FF)
  • GREEN (0xFF008000)
  • PINK (0xFFFFC0CB)
  • MAGENTA (0xFFFF00FF)
  • PURPLE (0xFF800080)
  • LIME (0xFF00FF00)
  • YELLOW (0xFFFFFF00)
  • ORANGE (0xFFFFA500)
  • CYAN (0xFF00FFFF)

Color Functions

setSpriteColor(sprite:String, value:String) -> Void

Self-explainatory, ain't it?

  • sprite: Object / Sprite
  • value: A color in HEX (0xAARRGGBB)

Example:

clr.setSpriteColor("dad", clr.RED);

getSpriteColor(sprite:String) -> String

Basically getProperty("object.color")

  • sprite: Object / Sprite

Example:

clr.getSpriteColor("dad");

-- You can use it like this
setProperty("boyfriend.color", clr.getSpriteColor("dad"));

setSpriteColorTransform(sprite:String, multipliers:Array[Float], offsets:Array[Float]) -> Void

Sets the sprite's color transform

  • sprite: Object / Sprite
  • multipliers, offsets
{
    red:Float,
    green:Float,
    blue:Float,
    alpha:Float
}

Example:

-- this makes dad completely white
clr.setSpriteColorTransform("dad", {255, 255, 255, 1}, {255, 255, 255, 1});

rgbToHex(r:Int, g:Int, b:Int) -> String

Converts RGB to HEX : (255, 0, 0) -> 0xFFFF0000

  • r: Red value
  • g: Green value
  • b: Blue value

Example:

setProperty("boyfriend.color", clr.rgbToHex(255, 0, 0));
-- This is RED thus, FF0000