Libraries.Game.Graphics.Color Documentation

The Color class stores information about a color used by the game engine. Colors are stored as a combination of red, green, blue, and alpha (or opacity). All four values may be set from 0 to 1, where 0 represents the total lack of a color or full transparency, and 1 represents full presence of that color or total opacity.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle1
            Drawable rectangle2
            Drawable rectangle3

            Color blue
            Color yellow
            Color glassy

            action Main
                StartGame()
            end

            action CreateGame
                blue:SetColor(0, 0, 1, 1)
                rectangle1:LoadFilledRectangle(100, 50, blue)

                yellow:SetColor(1, 1, 0, 1)
                rectangle2:LoadFilledRectangle(100, 50, yellow)

                glassy:SetColor(1, 1, 1, 0.25)
                rectangle3:LoadFilledRectangle(100, 50, glassy)

                rectangle1:SetPosition(50, 50)
                rectangle2:SetPosition(200, 50)
                rectangle3:SetPosition(125, 65)
               
                Add(rectangle1)
                Add(rectangle2)
                Add(rectangle3)
            end
        e

Inherits from: Libraries.Game.Graphics.ColorGroup, Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Black()This action returns a new Color object that is black.
Blue()This action returns a new Color object that is blue.
Clamp()This action sets all color component values to be between 0 and 1.
Clear()This action returns a new Color object that is clear.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Copy()This action returns a new color that is a copy of this color.
CopyColor(Libraries.Game.Graphics.Color copyColor)This action sets this color to be identical to the given color parameter.
CustomColor(number red, number green, number blue, number alpha)This action returns a new color with the given red, green, blue, and alpha values, where 0 represents a total absence of that component and 1 represents a full presence of it.
Cyan()This action returns a new Color object that is cyan.
DarkGray()This action returns a new Color object that is dark gray.
EncodeColorAsNumber()This action encodes this color as a number.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetAlpha()This action returns the alpha component of this color.
GetBlue()This action returns the blue component of this color.
GetBottomLeft()This action returns what color is applied to the bottom left corner of an object which is using this Color.
GetBottomRight()This action returns what color is applied to the bottom right corner of an object which is using this Color.
GetColorCode()This action will return the color as an integer in the RGBA8888 format, or in other words, in the 32 bit integer, the highest 8 bits represent the red, the next 8 represent the green, the next 8 represent the blue, and the final 8 represent the alpha (which is usually transparency).
GetGreen()This action returns the green component of this color.
GetHashCode()This action gets the hash code for an object.
GetRed()This action returns the red component of this color.
GetTopLeft()This action returns what color is applied to the top left corner of an object which is using this Color.
GetTopRight()This action returns what color is applied to the top right corner of an object which is using this Color.
Gray()This action returns a new Color object that is gray.
Green()This action returns a new Color object that is green.
LightGray()This action returns a new Color object that is light gray.
LinearInterpolation(Libraries.Game.Graphics.Color targetColor, number coefficient)This action will perform linear interpolation between this Color and the provided target Color using the given interpolation coefficient, which can be between 0 and 1 (inclusive).
LinearInterpolation(number r, number g, number b, number a, number coefficient)This action will perform linear interpolation between this Color and the provided red, green, blue, and alpha color values using the given interpolation coefficient, which can be between 0 and 1 (inclusive).
Magenta()This action returns a new Color object that is magenta.
Maroon()This action returns a new Color object that is maroon.
Navy()This action returns a new Color object that is navy.
Olive()This action returns a new Color object that is olive.
Orange()This action returns a new Color object that is orange.
Pink()This action returns a new Color object that is pink.
Purple()This action returns a new Color object that is purple.
Red()This action returns a new Color object that is red.
SetAlpha(number aVal)This action sets the alpha component of this color.
SetBlue(number bVal)This action sets the blue component of this color.
SetColor(number redValue, number greenValue, number blueValue, number alphaValue)This action sets a color by setting its red, green, blue, and alpha values, where 0 represents a total absence of that component and 1 represents a full presence of it.
SetColorFromCode(integer code)This action is used internally by the game engine to set a color using an integer value representing a color.
SetGreen(number gVal)This action sets the green component of this color.
SetRed(number rVal)This action sets the red component of this color.
Teal()This action returns a new Color object that is teal.
White()This action returns a new Color object that is white.
Yellow()This action returns a new Color object that is yellow.

Actions Documentation

Black()

This action returns a new Color object that is black.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Black()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Blue()

This action returns a new Color object that is blue.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Blue()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Clamp()

This action sets all color component values to be between 0 and 1.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color:SetRed(50)
                color:SetBlue(-10)
                color:SetGreen(0.5)
                color:SetAlpha(1)
                color:Clamp()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Clear()

This action returns a new Color object that is clear.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Clear()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Example Code

Object o
        Object t
        integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Copy()

This action returns a new color that is a copy of this color.

Example Code

use Libraries.Game.Graphics.Color
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                Color original
                Color copy

                action Main is Game
                    StartGame()
                end

                action CreateGame
                    original = original:Navy()
                    copy = original:Copy()
                end
            e

Return

Libraries.Game.Graphics.Color:

CopyColor(Libraries.Game.Graphics.Color copyColor)

This action sets this color to be identical to the given color parameter.

Example Code

use Libraries.Game.Graphics.Color
            use Libraries.Game.Graphics.Drawable
            use Libraries.Game.Game

            class Main is Game
                
                Color original
                Color copy

                action Main is Game
                    StartGame()
                end

                action CreateGame
                    original = original:Navy()
                    copy:CopyColor(original)
                end
            e

Parameters

CustomColor(number red, number green, number blue, number alpha)

This action returns a new color with the given red, green, blue, and alpha values, where 0 represents a total absence of that component and 1 represents a full presence of it. Alpha is the opacity of a color, where 0 represents total transparency and 1 represents total opacity.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                rectangle:LoadFilledRectangle(100, 50, color:CustomColor(1, 0.7, 0, 1))
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Parameters

Return

Libraries.Game.Graphics.Color:

Cyan()

This action returns a new Color object that is cyan.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Cyan()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

DarkGray()

This action returns a new Color object that is dark gray.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:DarkGray()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

EncodeColorAsNumber()

This action encodes this color as a number. This is used primarily for internal use, and most users will never need to use this action directl

Return

number:

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GetAlpha()

This action returns the alpha component of this color.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color:SetColor(0.5, 0.7, 0.9, 1)
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
                output "The alpha value is " + color:GetAlpha()
            end
        e

Return

number:

GetBlue()

This action returns the blue component of this color.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color:SetColor(0.5, 0.7, 0.9, 1)
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
                output "The blue value is " + color:GetBlue()
            end
        e

Return

number:

GetBottomLeft()

This action returns what color is applied to the bottom left corner of an object which is using this Color. Note that for a Color object, the returned value is the same Color object from which the action was called, and all four corner actions (GetTopLeft(), GetTopRight(), GetBottomLeft(), and GetBottomRight()) return the same value.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Gradient

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color
            color = color:Orange()
            
            Color corner = gradient:GetBottomLeft()
            output "The color's values are: " + corner:GetRed() + ", " + corner:GetBlue() + ", " + corner:GetGreen() + ", " + corner:GetAlpha()
        end

    e

Return

Libraries.Game.Graphics.Color: The Color object that the action was called from.

GetBottomRight()

This action returns what color is applied to the bottom right corner of an object which is using this Color. Note that for a Color object, the returned value is the same Color object from which the action was called, and all four corner actions (GetTopLeft(), GetTopRight(), GetBottomLeft(), and GetBottomRight()) return the same value.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Gradient

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color
            color = color:Orange()
            
            Color corner = gradient:GetTopLeft()
            output "The color's values are: " + corner:GetRed() + ", " + corner:GetBlue() + ", " + corner:GetGreen() + ", " + corner:GetAlpha()
        end

    e

Return

Libraries.Game.Graphics.Color: The Color object that the action was called from.

GetColorCode()

This action will return the color as an integer in the RGBA8888 format, or in other words, in the 32 bit integer, the highest 8 bits represent the red, the next 8 represent the green, the next 8 represent the blue, and the final 8 represent the alpha (which is usually transparency). This is used primarily for internal use, and most users will never need to use this action directl

Return

integer:

GetGreen()

This action returns the green component of this color.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color:SetColor(0.5, 0.7, 0.9, 1)
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
                output "The green value is " + color:GetGreen()
            end
        e

Return

number:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode

Return

integer: The integer hash code of the object.

GetRed()

This action returns the red component of this color.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color:SetColor(0.5, 0.7, 0.9, 1)
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
                output "The red value is " + color:GetRed()
            end
        e

Return

number:

GetTopLeft()

This action returns what color is applied to the top left corner of an object which is using this Color. Note that for a Color object, the returned value is the same Color object from which the action was called, and all four corner actions (GetTopLeft(), GetTopRight(), GetBottomLeft(), and GetBottomRight()) return the same value.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Gradient

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color
            color = color:Orange()
            
            Color corner = gradient:GetTopLeft()
            output "The color's values are: " + corner:GetRed() + ", " + corner:GetBlue() + ", " + corner:GetGreen() + ", " + corner:GetAlpha()
        end

    e

Return

Libraries.Game.Graphics.Color: The Color object that the action was called from.

GetTopRight()

This action returns what color is applied to the top right corner of an object which is using this Color. Note that for a Color object, the returned value is the same Color object from which the action was called, and all four corner actions (GetTopLeft(), GetTopRight(), GetBottomLeft(), and GetBottomRight()) return the same value.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.Gradient

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color
            color = color:Orange()
            
            Color corner = gradient:GetTopRight()
            output "The color's values are: " + corner:GetRed() + ", " + corner:GetBlue() + ", " + corner:GetGreen() + ", " + corner:GetAlpha()
        end

    e

Return

Libraries.Game.Graphics.Color: The Color object that the action was called from.

Gray()

This action returns a new Color object that is gray.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Gray()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Green()

This action returns a new Color object that is green.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Green()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

LightGray()

This action returns a new Color object that is light gray.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:LightGray()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

LinearInterpolation(Libraries.Game.Graphics.Color targetColor, number coefficient)

This action will perform linear interpolation between this Color and the provided target Color using the given interpolation coefficient, which can be between 0 and 1 (inclusive). The Color that called this action will be changed to reflect the results of the linear interpolation.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color
            Color targetColor

            action Main
                StartGame()
            end

            action CreateGame
                rectangle:LoadFilledRectangle(100, 50, color:White())
                rectangle:SetPosition(50, 50)
                Add(rectangle)

                color:SetColor(1, 1, 1, 1)
                targetColor:SetColor(1, 0, 0, 1)
            end

            action Update(number seconds)
                color:LinearInterpolation(targetColor, 0.5 * seconds)
                rectangle:SetColor(color)
            end
        e

Parameters

LinearInterpolation(number r, number g, number b, number a, number coefficient)

This action will perform linear interpolation between this Color and the provided red, green, blue, and alpha color values using the given interpolation coefficient, which can be between 0 and 1 (inclusive). The Color that called this action will be changed to reflect the results of the linear interpolation.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                rectangle:LoadFilledRectangle(100, 50, color:White())
                rectangle:SetPosition(50, 50)
                Add(rectangle)

                color:SetColor(1, 1, 1, 1)
            end

            action Update(number seconds)
                color:LinearInterpolation(1, 0, 0, 1, 0.5 * seconds)
                rectangle:SetColor(color)
            end
        e

Parameters

Magenta()

This action returns a new Color object that is magenta.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Magenta()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Maroon()

This action returns a new Color object that is maroon.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Maroon()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

This action returns a new Color object that is navy.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Navy()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Olive()

This action returns a new Color object that is olive.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Olive()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Orange()

This action returns a new Color object that is orange.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Orange()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Pink()

This action returns a new Color object that is pink.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Pink()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Purple()

This action returns a new Color object that is purple.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Purple()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Red()

This action returns a new Color object that is red.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Red()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

SetAlpha(number aVal)

This action sets the alpha component of this color. The value passed should be between 0 and 1, where 0 represents total transparency, and 1 represents total opacity.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color black

            action Main
                StartGame()
            end

            action CreateGame
                black:SetAlpha(1)
                rectangle:LoadFilledRectangle(100, 50, black)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Parameters

SetBlue(number bVal)

This action sets the blue component of this color. The value passed should be between 0 and 1, where 0 represents a total lack of blue, and 1 represents a full presence of blue.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color blue

            action Main
                StartGame()
            end

            action CreateGame
                blue:SetBlue(1)
                blue:SetAlpha(1)
                rectangle:LoadFilledRectangle(100, 50, blue)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Parameters

SetColor(number redValue, number greenValue, number blueValue, number alphaValue)

This action sets a color by setting its red, green, blue, and alpha values, where 0 represents a total absence of that component and 1 represents a full presence of it. Alpha is the opacity of a color, where 0 represents total transparency and 1 represents total opacity.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color orange

            action Main
                StartGame()
            end

            action CreateGame
                orange:SetColor(1, 0.7, 0, 1)
                rectangle:LoadFilledRectangle(100, 50, orange)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Parameters

SetColorFromCode(integer code)

This action is used internally by the game engine to set a color using an integer value representing a color. Most users will never need to use this action directl

Parameters

SetGreen(number gVal)

This action sets the green component of this color. The value passed should be between 0 and 1, where 0 represents a total lack of green, and 1 represents a full presence of green.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color green

            action Main
                StartGame()
            end

            action CreateGame
                green:SetGreen(1)
                green:SetAlpha(1)
                rectangle:LoadFilledRectangle(100, 50, green)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Parameters

SetRed(number rVal)

This action sets the red component of this color. The value passed should be between 0 and 1, where 0 represents a total lack of red, and 1 represents a full presence of red.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color red

            action Main
                StartGame()
            end

            action CreateGame
                red:SetRed(1)
                red:SetAlpha(1)
                rectangle:LoadFilledRectangle(100, 50, red)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Parameters

Teal()

This action returns a new Color object that is teal.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Teal()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

White()

This action returns a new Color object that is white.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:White()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color:

Yellow()

This action returns a new Color object that is yellow.

Example Code

use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color
        use Libraries.Game.Game

        class Main is Game

            Drawable rectangle

            Color color

            action Main
                StartGame()
            end

            action CreateGame
                color = color:Yellow()
                rectangle:LoadFilledRectangle(100, 50, color)
                rectangle:SetPosition(50, 50)
                Add(rectangle)
            end
        e

Return

Libraries.Game.Graphics.Color: