c# change color of sprites using a foreach loop
<p>Hi guys i am beginner in C# programming and I need someone to explain me how I can change the colors of sprites. One said me that i can do this using a <code>foreach</code> loop however I get the same color red color:</p>

<p>The code:</p>

<pre><code>using System;
using System.Text;
using System.Drawing;
using System.Threading.Tasks;

using Ionic.Zlib;

using Sulakore.Protocol;
using Sulakore.Extensions;

using Habbogram.Camera;
using Habbogram.Communication;

namespace Habbogram
{
    public partial class MainFrm : ExtensionForm
    {
        private const string PREVIEW_IMAGE_BASE_URL = "https://habbo-stories-content.s3.amazonaws.com/";

        private readonly Random _colorGenerator;

        private TaskCompletionSource&lt;bool&gt; _wasReplacedAwaitable;
        private readonly Action&lt;HPhoto&gt; _onCameraPayloadIntercepted;

        public CameraTriggers GramTriggers { get; }
        public HPhoto CurrentPhoto { get; private set; }
        public override bool IsExternal { get; } = true;

        public MainFrm()
        {
            InitializeComponent();

            _colorGenerator = new Random();
            _wasReplacedAwaitable = new TaskCompletionSource&lt;bool&gt;();
            _onCameraPayloadIntercepted = OnCameraPayloadIntercepted;

            GramTriggers = new CameraTriggers(true);
            GramTriggers.DetectIncoming = false;
            Triggers = GramTriggers;

            GramTriggers.CameraPayload += GramTriggers_CameraPayload;
        }

        private void UpdateInterface(HPhoto photo)
        {
            bool isReplacing = (photo != null);
            CancelBtn.Enabled = (ReplaceBtn.Enabled = isReplacing);

            PlanesTab.Text = $"Planes({photo?.Planes.Count ?? 0})";
            SpritesTab.Text = $"Sprites({photo?.Sprites.Count ?? 0})";
            FiltersTab.Text = $"Filters({photo?.Filters.Count ?? 0})";

            SpriteTxt.DataSource = photo?.Sprites;
            SpriteTxt.Enabled = (photo != null);
        }
        private Color GenerateRandomColor(byte alpha)
        {
            byte a = alpha;
            int r = _colorGenerator.Next(0, 126);
            int g = _colorGenerator.Next(0, 126);
            int b = _colorGenerator.Next(0, 126);

            return Color.FromArgb(alpha, r, g, b);
        }
        private void OnCameraPayloadIntercepted(HPhoto photo)
        {
            if (InvokeRequired) Invoke(_onCameraPayloadIntercepted, photo);
            else UpdateInterface(photo);
        }

        private void CancelBtn_Click(object sender, EventArgs e)
        {
            _wasReplacedAwaitable.SetResult(false);
            UpdateInterface(null);
        }
        private void ReplaceBtn_Click(object sender, EventArgs e)
        {
            _wasReplacedAwaitable.SetResult(true);
            UpdateInterface(null);
        }
        private void InterceptChckbx_CheckedChanged(object sender, EventArgs e)
        {
            if (InterceptChckbx.Checked)
            {
                GramTriggers.CameraPayload += GramTriggers_CameraPayload;
            }
            else
            {
                GramTriggers.CameraPayload -= GramTriggers_CameraPayload;
                UpdateInterface(null);
            }
        }
        private void GramTriggers_CameraPayload(object sender, CameraPayloadEventArgs e)
        {
            try
            {
                e.ContinueRead();

                byte[] jsonPayload = ZlibStream.UncompressBuffer(e.JsonPayload);
                string json = Encoding.UTF8.GetString(jsonPayload);

                CurrentPhoto = HPhoto.Create(json);
                OnCameraPayloadIntercepted(CurrentPhoto);
                foreach (Camera.Layers.Sprite s in CurrentPhoto.Sprites)
                {
                    //Set color for all sprites in the photo.
                        s.Color = Color.FromArgb(1, 255, 1, 1).ToArgb();
                }

                // Wait for user to invoke a 'replace'.
                bool wasReplaced = _wasReplacedAwaitable.Task.Result;
                if (!wasReplaced) return; // User cancelled.

                json = CurrentPhoto.ToJson();

                byte[] compressedJson = Encoding.UTF8.GetBytes(json);
                compressedJson = ZlibStream.CompressBuffer(compressedJson);

                e.Replacement = new HMessage(e.Packet.Header,
                    compressedJson.Length, compressedJson);
            }
            finally
            {
                // Create new instance, so that we don't wait for an already completed task.
                _wasReplacedAwaitable = new TaskCompletionSource&lt;bool&gt;();
            }
        }
    }
}
</code></pre>