Created
January 10, 2019 16:09
-
-
Save alphaKAI/dee3392a1632e6e284fee10482f52835 to your computer and use it in GitHub Desktop.
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.Runtime.InteropServices | |
open System | |
[<DllImport("kernel32.dll", SetLastError = true)>] | |
extern IntPtr GetStdHandle(int nStdHandle) | |
[<DllImport("kernel32.dll", SetLastError = true)>] | |
extern bool GetConsoleMode(IntPtr hConsoleHandle, uint32& lpMode) | |
[<DllImport("Kernel32.dll", SetLastError = true)>] | |
extern bool SetConsoleMode(IntPtr hConsoleHandle, uint32 dwMode) | |
let STD_OUTPUT_HANDLE = -11 | |
let ENABLE_VIRTUAL_TERMINAL_PROCESSING = uint32 0x0004 | |
let hOut = GetStdHandle(STD_OUTPUT_HANDLE) | |
let mutable dwMode = uint32 0 | |
GetConsoleMode(hOut, &dwMode) | |
let dwMode2 = dwMode ||| ENABLE_VIRTUAL_TERMINAL_PROCESSING | |
SetConsoleMode(hOut, dwMode2) | |
printfn "\x1b[33m" | |
printfn "TEST" | |
printfn "\x1b[0m\x1b[0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment