# HG changeset patch # User Jason Maltzen # Date 2021-09-09 23:55:08 # Node ID 8da5f6699d575b6a84bda15630efb051a4260b95 # Parent dd8780bb11c5e3fd59d87f21e5243abce720eb89 Add constructor / setter to PaintColor to copy another paint color and assign a different name to it. diff --git a/Models/PaintColor.cs b/Models/PaintColor.cs --- a/Models/PaintColor.cs +++ b/Models/PaintColor.cs @@ -48,6 +48,22 @@ namespace DesertPaintCodex.Models Blue = other.Blue; } + public PaintColor(string name, PaintColor other) + { + Name = name; + Red = other.Red; + Green = other.Green; + Blue = other.Blue; + } + + public void Set(string name, PaintColor other) + { + Name = name; + Red = other.Red; + Green = other.Green; + Blue = other.Blue; + } + public int GetDistanceSquared(PaintColor otherColor) { return (int)(Math.Pow(Red - otherColor.Red, 2) +