NewColor Method


Returns a new color object.

Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)

Syntax

C#
public Color NewColor()
Visual Basic
Public Function NewColor As Color
Visual C++
public:
Color^ NewColor()

Return Value

The new color object.

Examples

Copy C#
Color NewColorInfo(Autodesk.Revit.Creation.Application appCreation)
{
    // Create a new color
    Autodesk.Revit.DB.Color color = appCreation.NewColor();

    // Set its RGB values
    color.Red = (byte)127;
    color.Green = (byte)64;
    color.Blue = (byte)32;

    // Display the color info
    StringBuilder info = new StringBuilder();
    info.AppendLine("Red:\t" + color.Red.ToString());
    info.AppendLine("Green:\t" + color.Green.ToString());
    info.AppendLine("Blue:\t" + color.Blue.ToString());

    TaskDialog.Show("Revit",info.ToString());

    return color;
}
Copy VB.NET
Private Function NewColorInfo(appCreation As Autodesk.Revit.Creation.Application) As Color
    ' Create a new color
    Dim color As Autodesk.Revit.DB.Color = appCreation.NewColor()

    ' Set its RGB values
    color.Red = CByte(127)
    color.Green = CByte(64)
    color.Blue = CByte(32)

    ' Display the color info
    Dim info As New StringBuilder()
    info.AppendLine("Red:" & vbTab & color.Red.ToString())
    info.AppendLine("Green:" & vbTab & color.Green.ToString())
    info.AppendLine("Blue:" & vbTab & color.Blue.ToString())

    TaskDialog.Show("Revit", info.ToString())

    Return color
End Function

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →