Show / Hide Table of Contents

Class AciColor

Represents an ACI color (AutoCAD Color Index) that also supports true color.

Inheritance
System.Object
AciColor
Implements
System.ICloneable
System.IEquatable<AciColor>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: netDxf
Assembly: CADability.dll
Syntax
public class AciColor : ICloneable, IEquatable<AciColor>

Constructors

| Improve this Doc View Source

AciColor()

Initializes a new instance of the AciColor class with black/white color index 7.

Declaration
public AciColor()
| Improve this Doc View Source

AciColor(Byte, Byte, Byte)

Initializes a new instance of the AciColor class.

Declaration
public AciColor(byte r, byte g, byte b)
Parameters
Type Name Description
System.Byte r

Red component.

System.Byte g

Green component.

System.Byte b

Blue component.

Remarks

By default the UseTrueColor will be set to true.

| Improve this Doc View Source

AciColor(Double, Double, Double)

Initializes a new instance of the AciColor class.

Declaration
public AciColor(double r, double g, double b)
Parameters
Type Name Description
System.Double r

Red component.

System.Double g

Green component.

System.Double b

Blue component.

Remarks

By default the UseTrueColor will be set to true.

| Improve this Doc View Source

AciColor(Color)

Initializes a new instance of the AciColor class.

Declaration
public AciColor(Color color)
Parameters
Type Name Description
System.Drawing.Color color

A System.Drawing.Color.

Remarks

By default the UseTrueColor will be set to true.

| Improve this Doc View Source

AciColor(Int16)

Initializes a new instance of the AciColor class.

Declaration
public AciColor(short index)
Parameters
Type Name Description
System.Int16 index

Color index.

Remarks

By default the UseTrueColor will be set to false.
Accepted color index values range from 1 to 255.
Indexes from 1 to 255 represents a color, the index 0 and 256 are reserved for ByLayer and ByBlock colors.

| Improve this Doc View Source

AciColor(Single, Single, Single)

Initializes a new instance of the AciColor class.

Declaration
public AciColor(float r, float g, float b)
Parameters
Type Name Description
System.Single r

Red component.

System.Single g

Green component.

System.Single b

Blue component.

Remarks

By default the UseTrueColor will be set to true.

Properties

| Improve this Doc View Source

B

Gets the blue component of the AciColor.

Declaration
public byte B { get; }
Property Value
Type Description
System.Byte
| Improve this Doc View Source

Blue

Defines a default blue color.

Declaration
public static AciColor Blue { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

ByBlock

Gets the ByBlock color.

Declaration
public static AciColor ByBlock { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

ByLayer

Gets the ByLayer color.

Declaration
public static AciColor ByLayer { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

Cyan

Defines a default cyan color.

Declaration
public static AciColor Cyan { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

DarkGray

Defines a default dark gray color.

Declaration
public static AciColor DarkGray { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

Default

Defines a default white/black color.

Declaration
public static AciColor Default { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

G

Gets the green component of the AciColor.

Declaration
public byte G { get; }
Property Value
Type Description
System.Byte
| Improve this Doc View Source

Green

Defines a default green color.

Declaration
public static AciColor Green { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

Index

Gets or sets the color index.

Declaration
public short Index { get; set; }
Property Value
Type Description
System.Int16
Remarks

Accepted color index values range from 1 to 255. Indexes from 1 to 255 represents a color, the index 0 and 256 are reserved for ByLayer and ByBlock colors.

| Improve this Doc View Source

IndexRgb

A dictionary that contains the indexed colors, the key represents the color index and the value the RGB components of the color.

Declaration
public static IReadOnlyDictionary<byte, byte[]> IndexRgb { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyDictionary<System.Byte, System.Byte[]>
| Improve this Doc View Source

IsByBlock

Defines if the color is defined by block.

Declaration
public bool IsByBlock { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsByLayer

Defines if the color is defined by layer.

Declaration
public bool IsByLayer { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

LightGray

Defines a default light gray color.

Declaration
public static AciColor LightGray { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

Magenta

Defines a default magenta color.

Declaration
public static AciColor Magenta { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

R

Gets the red component of the AciColor.

Declaration
public byte R { get; }
Property Value
Type Description
System.Byte
| Improve this Doc View Source

Red

Defines a default red color.

Declaration
public static AciColor Red { get; }
Property Value
Type Description
AciColor
| Improve this Doc View Source

UseTrueColor

Get or set if the AciColor should use true color values.

Declaration
public bool UseTrueColor { get; set; }
Property Value
Type Description
System.Boolean
Remarks

By default, the constructors that use RGB values will set this boolean to true while the constants and the constructor that use a color index will set it to false.

| Improve this Doc View Source

Yellow

Defines a default yellow color.

Declaration
public static AciColor Yellow { get; }
Property Value
Type Description
AciColor

Methods

| Improve this Doc View Source

Clone()

Creates a new color that is a copy of the current instance.

Declaration
public object Clone()
Returns
Type Description
System.Object

A new color that is a copy of this instance.

| Improve this Doc View Source

Equals(AciColor)

Check if the components of two colors are equal.

Declaration
public bool Equals(AciColor other)
Parameters
Type Name Description
AciColor other

Another color to compare to.

Returns
Type Description
System.Boolean

True if the three components are equal or false in any other case.

| Improve this Doc View Source

FromCadIndex(Int16)

Gets the AciColor from an index.

Declaration
public static AciColor FromCadIndex(short index)
Parameters
Type Name Description
System.Int16 index

A CAD indexed AciColor index.

Returns
Type Description
AciColor

A AciColor.

Remarks

Accepted index values range from 0 to 256. An index 0 represents a ByBlock color and an index 256 is a ByLayer color; any other value will return one of the 255 indexed AciColors.

| Improve this Doc View Source

FromColor(Color)

Converts a System.Drawing.Color to an System.Drawing.Color.

Declaration
public void FromColor(Color color)
Parameters
Type Name Description
System.Drawing.Color color

A System.Drawing.Color.

| Improve this Doc View Source

FromHsl(Vector3)

Converts HSL (hue, saturation, lightness) value to an AciColor.

Declaration
public static AciColor FromHsl(Vector3 hsl)
Parameters
Type Name Description
Vector3 hsl

A Vector3 containing the hue, saturation, and lightness components.

Returns
Type Description
AciColor

An System.Drawing.Color that represents the actual HSL value.

| Improve this Doc View Source

FromHsl(Double, Double, Double)

Converts HSL (hue, saturation, lightness) value to an AciColor.

Declaration
public static AciColor FromHsl(double hue, double saturation, double lightness)
Parameters
Type Name Description
System.Double hue

Hue (input values range from 0 to 1).

System.Double saturation

Saturation percentage (input values range from 0 to 1).

System.Double lightness

Lightness percentage (input values range from 0 to 1).

Returns
Type Description
AciColor

An System.Drawing.Color that represents the actual HSL value.

| Improve this Doc View Source

FromTrueColor(Int32)

Gets the AciColor from a 24-bit color value.

Declaration
public static AciColor FromTrueColor(int value)
Parameters
Type Name Description
System.Int32 value

A 24-bit color value (BGR order).

Returns
Type Description
AciColor

A AciColor.

| Improve this Doc View Source

ToColor()

Converts the AciColor to a System.Drawing.Color.

Declaration
public Color ToColor()
Returns
Type Description
System.Drawing.Color

A System.Drawing.Color that represents the actual AciColor.

Remarks

A default color white will be used for ByLayer and ByBlock colors.

| Improve this Doc View Source

ToHsl(AciColor)

Converts the RGB (red, green, blue) components of an AciColor to HSL (hue, saturation, lightness) values.

Declaration
public static Vector3 ToHsl(AciColor color)
Parameters
Type Name Description
AciColor color

A AciColor.

Returns
Type Description
Vector3

A Vector3 where the three coordinates x, y, z represents the hue, saturation, and lightness components (output values range from 0 to 1).

| Improve this Doc View Source

ToHsl(AciColor, out Double, out Double, out Double)

Converts the RGB (red, green, blue) components of an AciColor to HSL (hue, saturation, lightness) values.

Declaration
public static void ToHsl(AciColor color, out double hue, out double saturation, out double lightness)
Parameters
Type Name Description
AciColor color

A AciColor.

System.Double hue

Hue (output values range from 0 to 1).

System.Double saturation

Saturation (output values range from 0 to 1).

System.Double lightness

Lightness (output values range from 0 to 1).

| Improve this Doc View Source

ToString()

Converts the value of this instance to its equivalent string representation.

Declaration
public override string ToString()
Returns
Type Description
System.String

The string representation.

Overrides
System.Object.ToString()
| Improve this Doc View Source

ToTrueColor(AciColor)

Gets the 24-bit color value from an AciColor.

Declaration
public static int ToTrueColor(AciColor color)
Parameters
Type Name Description
AciColor color

A AciColor.

Returns
Type Description
System.Int32

A 24-bit color value (BGR order).

Implements

System.ICloneable
System.IEquatable<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX