# nodesnim/nodescontrol/color_rect

Dark Mode

Search:
Group by:

Displays colour rectangle.

# Imports

../thirdparty/opengl, ../core/vector2, ../core/rect2, ../core/anchor, ../core/input, ../core/color, ../core/enums, ../nodes/node, control

# Types

    ColorRectObj = object of ControlRef
      color*: ColorRef

    ColorRectRef = ref ColorRectObj

# Procs

    proc ColorRect(name: string = "ColorRect"): ColorRectRef {...}{.raises: [], tags: [].}

  Creates a new ColorRect.

  Arguments:

  - `name` is a node name.

  Examples:

      var colorrect1 = ColorRect("ColorRect")

# Methods

    method draw(self: ColorRectRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
        tags: [RootEffect].}

  this method uses in the `window.nim`.

    method duplicate(self: ColorRectRef): ColorRectRef {...}{.base, raises: [], tags: [].}

  Duplicates ColorRect object and create a new ColorRect.