1 // 2 // Copyright (c) 2016-2019 The Aurora Authors. All rights reserved. 3 // This program is free software. It comes without any warranty, 4 // to the extent permitted by applicable law. You can redistribute 5 // it and/or modify it under the terms of the Unlicense. See LICENSE 6 // file for more details or see below. 7 // 8 9 // 10 // DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 // Version 2, December 2004 12 // 13 // Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> 14 // 15 // Everyone is permitted to copy and distribute verbatim or modified 16 // copies of this license document, and changing it is allowed as long 17 // as the name is changed. 18 // 19 // DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 20 // TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 21 // 22 // 0. You just DO WHAT THE FUCK YOU WANT TO. 23 // 24 25 package aurora 26 27 import ( 28 "fmt" 29 ) 30 31 func ExampleRed() { 32 fmt.Println("value exceeds min-threshold:", Red(3.14)) 33 34 // Output: value exceeds min-threshold: [31m3.14[0m 35 } 36 37 func ExampleBold() { 38 fmt.Println("value:", Bold(Green(99))) 39 40 // Output: value: [1;32m99[0m 41 } 42 43 func ExampleNewAurora_no_colors() { 44 a := NewAurora(false) 45 fmt.Println(a.Red("Not red")) 46 47 // Output: Not red 48 } 49 50 func ExampleNewAurora_colors() { 51 a := NewAurora(true) 52 fmt.Println(a.Red("Red")) 53 54 // Output: [31mRed[0m 55 } 56 57 func Example_printf() { 58 fmt.Printf("%d %s", Blue(100), BgBlue("cats")) 59 60 // Output: [34m100[0m [44mcats[0m 61 } 62 63 func ExampleSprintf() { 64 fmt.Print( 65 Sprintf( 66 Blue("we've got %d cats, but want %d"), // <- blue format 67 Cyan(5), 68 Bold(Magenta(25)), 69 ), 70 ) 71 72 // Output: [34mwe've got [0;36m5[0;34m cats, but want [0;1;35m25[0;34m[0m 73 } 74