Liste des valeurs RVB pour les couleurs indexées d'AutoCAD

Un petit bout de code pour exporter la liste des valeurs Rouge, Vert, Bleu pour les couleurs indexées d'AutoCAD :

[CommandMethod("DUMPCOLORS")]
public void DumpColors()
{
    using (var sw = new StreamWriter(@"C:\temp\acadColors.txt"))
    {
        sw.WriteLine(" I ; R ; G ; B ");
        for (short colorIndex = 1; colorIndex <= 255; colorIndex++)
        {
            using (Color color = Color.FromColorIndex(ColorMethod.ByAci, colorIndex))
            {
                sw.WriteLine("{0,3};{1,3};{2,3};{3,3}", colorIndex,
                    color.ColorValue.R, color.ColorValue.G, color.ColorValue.B);
            }
        }
    }
}

Ci-dessous le fichier résultant.

AttachmentSize
Plain text icon acadColors.txt4.25 KB

Etiquettes:

Add new comment