Last active
February 11, 2020 22:40
-
-
Save ohlawdie/e44272c388d68a0c3458400279265b77 to your computer and use it in GitHub Desktop.
Active Pattern Decomp #F
This file contains hidden or 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
| open System.Drawing | |
| let (|RGB|) (col : System.Drawing.Color) = | |
| ( col.R, col.G, col.B ) | |
| let (|HSB|) (col : System.Drawing.Color) = | |
| ( col.GetHue(), col.GetSaturation(), col.GetBrightness() ) | |
| let printRGB (col: System.Drawing.Color) = | |
| match col with | |
| | RGB(r, g, b) -> printfn " Red: %d Green: %d Blue: %d" r g b | |
| let printHSB (col: System.Drawing.Color) = | |
| match col with | |
| | HSB(h, s, b) -> printfn " Hue: %f Saturation: %f Brightness: %f" h s b | |
| let printAll col colorString = | |
| printfn "%s" colorString | |
| printRGB col | |
| printHSB col | |
| printAll Color.Red "Red" | |
| printAll Color.Black "Black" | |
| printAll Color.White "White" | |
| printAll Color.Gray "Gray" | |
| printAll Color.BlanchedAlmond "BlanchedAlmond" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment