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