Skip to content

Commit 34c982c

Browse files
committed
update docs
1 parent 6b05cd8 commit 34c982c

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ var fgHiColors = map[string]color.Attribute{
188188

189189
If you want High Intensity Colors then the Color name should start with `Hi`. If Color option is empty or invalid then Box with default Color is formed.
190190

191-
It can even have custom color which has to be provided as `[3]uint` and `uint` but the elements of the array must be in a range of `[0x0, 0xFF]` and `uint` must be in a range of `[0x000000, 0xFFFFFF]`.
191+
You can also have more 16 Colors but the terminals must be 24 bit and the `Color` field must be provided either as `[3]uint` or `uint` though the elements of the array must be in a range of `[0x0, 0xFF]` and `uint` must be in a range of `[0x000000, 0xFFFFFF]`.
192192

193193
If you want to use the string representation of the `Box` and print them for [`Windows Console`](https://en.wikipedia.org/wiki/Windows_Console) then you would have to use `box.Output` as the passing stream to the respective functions.
194194

doc.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,46 +37,48 @@ You will have to change your font accordingly to make it work.
3737
3838
Basic Example:
3939
40-
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"})
41-
Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
40+
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"})
41+
Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
4242
4343
You can specify and change the options by changing the above Config struct.
4444
45-
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", TitlePos: "Top", ContentAlign: "Left"})
45+
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", TitlePos: "Top", ContentAlign: "Left"})
4646
4747
You can also customize and change the TitlePos to Inside, Top, Bottom and ContentAlign to Left, Right and Center.
4848
By default TitlePos is Inside, ContentAlign is Left and Style is Single.
4949
5050
You can also use the String() method for the string representation of the Box.
5151
52+
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"})
53+
boxStr := Box.String("Box CLI Maker", "Highly Customized Terminal Box Maker")
54+
5255
If you want the Box to be printed correctly irrespective of if it will form the correct Color or not on Windows (as Windows Console only supports 16 Colors) then you will have to add Box.Output
5356
as the passing stream to stream based functions:
5457
55-
fmt.Fprintf(box.Output, boxStr)
56-
57-
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: "Cyan"})
58-
boxStr := Box.String("Box CLI Maker", "Highly Customized Terminal Box Maker")
58+
if runtime.GOOS == "windows" {
59+
fmt.Fprintf(box.Output, boxStr)
60+
}
5961
6062
The Custom Color option will not be applicable for terminals which don't have 24 bit support i.e. True Color ANSI Code.
6163
If it is used then the Color effect will not be there.
6264
6365
RGB Uint Example:
6466
65-
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: uint(0x34562f)})
66-
Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
67+
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: uint(0x34562f)})
68+
Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
6769
6870
Note: Uint must be in a range of [0x000000, 0xFFFFFF] else it will panic.
6971
7072
RGB [3]uint Example:
7173
72-
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: [3]uint{23, 56, 78}})
73-
Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
74+
Box := box.New(box.Config{Px: 2, Py: 5, Type: "Single", Color: [3]uint{23, 56, 78}})
75+
Box.Print("Box CLI Maker", "Highly Customized Terminal Box Maker")
7476
7577
Note: [3]uint array elements must be in a range of [0x0, 0xFF] else it will panic.
7678
7779
You can even make your custom Box Style by using struct box.Box:
7880
79-
config := box.Config{Px: 2, Py: 3, Type: "", TitlePos: "Inside"}
80-
boxNew := box.Box{TopRight: "*", TopLeft: "*", BottomRight: "*", BottomLeft: "*", Horizontal: "-", Vertical: "|", Config: config}
81+
config := box.Config{Px: 2, Py: 3, Type: "", TitlePos: "Inside"}
82+
boxNew := box.Box{TopRight: "*", TopLeft: "*", BottomRight: "*", BottomLeft: "*", Horizontal: "-", Vertical: "|", Config: config}
8183
*/
8284
package box

0 commit comments

Comments
 (0)