API Documentation > CorelDRAW > 2025-v26 > Color > IVGColor
Color.CopyAssign method
Copies color model assignment
Syntax:
Sub CopyAssign(ByVal Color As Color)
Parameters:
Name Type Description
Color
Remarks:
The CopyAssign method copies the color model properties from a color object and applies them to the active color in CorelDRAW. A color is an effect applied to an object that alters the object's appearance by the way it reflects light. A color model is a system that defines the number and type of colors that make up an image and that is used to organize and define colors according to a set of basic properties that can be reproduced. Black-and-white, grayscale, RGB, CMYK, and paletted are examples of popular color modes.
Examples:
The following VBA example uses a separate Color object to take an object's fill color and convert it to RGB, then checks if the color is red (that is, its Red component value is greater than 150, and both Blue and Green values are less than 100). If this is the case, the object is filled with black. Otherwise, the object's fill remains unchanged.
Sub Test()
Dim c As New Color
Dim s As Shape
For Each s In ActiveSelection.Shapes
  If s.Fill.Type = cdrUniformFill Then

 c.CopyAssign s.Fill.UniformColor

 c.ConvertToRGB

 If c.RGBRed > 150 And c.RGBGreen < 100 And c.RGBBlue < 100 Then


s.Fill.UniformColor.RGBAssign 0, 0, 0

 End If
  End If
Next s 
End Sub