SHARE
TWEET

Testing `ColorTranslator.FromHtml` with ARGB hex values.

Ahmed-Abdelhameed Oct 27th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try
  2. {
  3.     // Incrementing by 5 to save time. Using `++` would cover all possible values but takes a long time.
  4.     for (int a = 0; a <= 255; a += 5)
  5.         for (int r = 0; r <= 255; r += 5)
  6.             for (int g = 0; g <= 255; g += 5)
  7.                 for (int b = 0; b <= 255; b += 5)
  8.                     ColorTranslator.FromHtml($"#{a.ToString("X2")}{r.ToString("X2")}{g.ToString("X2")}{b.ToString("X2")}");
  9.     Console.WriteLine("All is good!");
  10. }
  11. catch (FormatException ex)
  12. {
  13.     Console.WriteLine($"Failed. Message='{ex.Message}'");
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top