Last active
September 6, 2020 11:44
-
-
Save ssukhpinder/33f204f3fda8ab97326b2b06a091405d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static NewSwitch FromRainbow(Color color) => | |
color switch | |
{ | |
Color.Red => new NewSwitch(0xFF, 0x00, 0x00), | |
Color.Orange => new NewSwitch(0xFF, 0x7F, 0x00), | |
Color.Yellow => new NewSwitch(0xFF, 0xFF, 0x00), | |
Color.Green => new NewSwitch(0x00, 0xFF, 0x00), | |
Color.Blue => new NewSwitch(0x00, 0x00, 0xFF), | |
Color.Indigo => new NewSwitch(0x4B, 0x00, 0x82), | |
Color.Violet => new NewSwitch(0x94, 0x00, 0xD3), | |
_ => throw new ArgumentException(message: "invalid color", paramName: nameof(color)), | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment