OSRS Plugin API
    Preparing search index...

    Class Colour

    Represents a colour in RGBA format, with each colour channel in the range of [0-255].

    Index

    Constructors

    Properties

    a b g r

    Methods

    Constructors

    Properties

    a: number

    The alpha channel range [0-255]. 255 is fully opaque.

    -- Create a new Colour
    local colour = osrs.Colour.new(255,0,0,255)
    -- Print the alpha channel number
    osrs.print(tostring(colour.a))
    -- Change the alpha channel number
    colour.a = 30
    -- Print the new alpha channel number
    osrs.print(tostring(colour.a))
    b: number

    The blue channel range [0-255].

    -- Create a new Colour
    local colour = osrs.Colour.new(255,0,0,255)
    -- Print the blue channel number
    osrs.print(tostring(colour.b))
    -- Change the blue channel number
    colour.b = 30
    -- Print the new blue channel number
    osrs.print(tostring(colour.b))
    g: number

    The green channel range [0-255].

    -- Create a new Colour
    local colour = osrs.Colour.new(255,0,0,255)
    -- Print the green channel number
    osrs.print(tostring(colour.g))
    -- Change the green channel number
    colour.g = 30
    -- Print the new green channel number
    osrs.print(tostring(colour.g))
    r: number

    The red channel range [0-255].

    -- Create a new Colour
    local colour = osrs.Colour.new(255,0,0,255)
    -- Print the red channel number
    osrs.print(tostring(colour.r))
    -- Change the red channel number
    colour.r = 30
    -- Print the new red channel number
    osrs.print(tostring(colour.r))

    Methods

    • Sets the Colour to the submitted values, and returns a reference to the Colour object.

      Parameters

      • r: number

        red-channel.

      • g: number

        green-channel.

      • b: number

        blue-channel.

      • a: number

        alpha-channel.

      Returns osrs.Colour

      Reference to the Colour object.

      -- Create a new Colour
      local colour = osrs.Colour.new(255,0,0,255)
      -- Print the red, blue, green, and alpha channels
      osrs.print("Color R: " .. tostring(colour.r) .. " G: " .. tostring(colour.g)
      .. " B: " .. tostring(colour.b) .. " A: " .. tostring(colour.a))
      -- Set the colour to something new
      colour:set(100, 255, 100, 50)
      -- Print the new red, blue, green, and alpha channels
      osrs.print("Color R: " .. tostring(colour.r) .. " G: " .. tostring(colour.g)
      .. " B: " .. tostring(colour.b) .. " A: " .. tostring(colour.a))
    • Instantiates a new Colour.

      Parameters

      • Optionalr: number

        the red-channel value, range [0-255]

      • Optionalg: number

        the green-channel value, range [0-255]

      • Optionalb: number

        the blue-channel value, range [0-255]

      • Optionala: number

        the alpha-channel value, range [0-255].

      Returns osrs.Colour

      The newly instantiated Colour.

      -- Create a new Colour
      local colour = osrs.Colour.new(255,0,0,255)