Skip to content

Commit

Permalink
Use Color objects instead of strings
Browse files Browse the repository at this point in the history
This allows for easier manipulation before use
  • Loading branch information
Joelius300 committed Oct 6, 2020
1 parent cc9f4fd commit e2e5a53
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ChartJs.Blazor.Samples/Shared/SampleUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Text;

namespace ChartJs.Blazor.Samples.Shared
Expand All @@ -12,18 +13,20 @@ public static class SampleUtils

public static class ChartColors
{
public static IReadOnlyList<string> All { get; } = new string[7]
private static readonly Lazy<IReadOnlyList<Color>> _all = new Lazy<IReadOnlyList<Color>>(() => new Color[7]
{
Red, Orange, Yellow, Green, Blue, Purple, Grey
};

public const string Red = "rgb(255, 99, 132)";
public const string Orange = "rgb(255, 159, 64)";
public const string Yellow = "rgb(255, 205, 86)";
public const string Green = "rgb(75, 192, 192)";
public const string Blue = "rgb(54, 162, 235)";
public const string Purple = "rgb(153, 102, 255)";
public const string Grey = "rgb(201, 203, 207";
});

public static IReadOnlyList<Color> All => _all.Value;

public static readonly Color Red = Color.FromArgb(255, 99, 132);
public static readonly Color Orange = Color.FromArgb(255, 159, 64);
public static readonly Color Yellow = Color.FromArgb(255, 205, 86);
public static readonly Color Green = Color.FromArgb(75, 192, 192);
public static readonly Color Blue = Color.FromArgb(54, 162, 235);
public static readonly Color Purple = Color.FromArgb(153, 102, 255);
public static readonly Color Grey = Color.FromArgb(201, 203, 207);
}

public static IReadOnlyList<string> Months { get; } = new ReadOnlyCollection<string>(new[]
Expand Down

0 comments on commit e2e5a53

Please sign in to comment.