Restructure and update example image

This commit is contained in:
Patrik Svensson
2020-08-25 11:19:58 +02:00
parent 695327ec72
commit c111c7d463
20 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Generated {{ date.now | date.to_string `%Y-%m-%d %k:%M` }}
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Diagnostics.CodeAnalysis;
namespace Spectre.Console
{
/// <summary>
/// Represents a color.
/// </summary>
public partial struct Color
{
internal Color(byte number, byte red, byte green, byte blue, bool isDefault = false)
: this(red, green, blue)
{
Number = number;
IsDefault = isDefault;
}
{{~ for color in colors }}
/// <summary>
/// Gets the color "{{ color.name }}" (RGB {{ color.r }},{{ color.g }},{{ color.b }}).
/// </summary>
{{- if string.contains color.name "_" }}
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores")]
{{- end}}
public static Color {{ color.name }} { get; } = new Color({{ color.number }}, {{ color.r }}, {{ color.g }}, {{ color.b }});
{{~ end ~}}
}
}

View File

@ -0,0 +1,47 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Generated {{ date.now | date.to_string `%Y-%m-%d %k:%M` }}
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Collections.Generic;
namespace Spectre.Console.Internal
{
internal static partial class ColorPalette
{
private static List<Color> GenerateLegacyPalette()
{
return new List<Color>
{
{{~ for number in 0..7 ~}}
Color.{{ colors[number].name }},
{{~ end ~}}
};
}
private static List<Color> GenerateStandardPalette(IReadOnlyList<Color> legacy)
{
return new List<Color>(legacy)
{
{{~ for number in 8..15 ~}}
Color.{{ colors[number].name }},
{{~ end ~}}
};
}
private static List<Color> GenerateEightBitPalette(IReadOnlyList<Color> standard)
{
return new List<Color>(standard)
{
{{~ for number in 16..255 ~}}
Color.{{ colors[number].name }},
{{~ end ~}}
};
}
}
}

View File

@ -0,0 +1,28 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Generated {{ date.now | date.to_string `%Y-%m-%d %k:%M` }}
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
namespace Spectre.Console.Internal
{
internal static partial class ColorTable
{
private static Dictionary<string, int> GenerateTable()
{
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
{
{{~ for color in colors ~}}
{ "{{ string.downcase color.name }}", {{ color.number }} },
{{~ end ~}}
};
}
}
}