public static Palette Create(string name, double hue, int count) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (hue < 0 || hue > 360) { throw new ArgumentOutOfRangeException(nameof(hue)); } if (count < 2) { throw new ArgumentOutOfRangeException(nameof(count)); } var palette = new Palette(name); var brightnessDelta = 0.5 / (count - 1); for (var idx = 0; idx < count; ++idx) { var brightness = 1.0 - (brightnessDelta * idx); var color = Color.FromAhsb(255, hue, 1.0, brightness); var paletteEntry = new PaletteEntry(new FabricStyle(color)); palette.Entries.Add(paletteEntry); } return(palette); }
protected PaletteEntry(PaletteEntry prototype) { if (prototype == null) { throw new ArgumentNullException(nameof(prototype)); } m_fabricStyle = prototype.m_fabricStyle?.Clone(); }