...

Source file src/github.com/jedib0t/go-pretty/v6/list/style.go

Documentation: github.com/jedib0t/go-pretty/v6/list

     1  package list
     2  
     3  import "github.com/jedib0t/go-pretty/v6/text"
     4  
     5  // Style declares how to render the List (items).
     6  type Style struct {
     7  	Format           text.Format // formatting for the Text
     8  	CharItemSingle   string      // the bullet for a single-item list
     9  	CharItemTop      string      // the bullet for the top-most item
    10  	CharItemFirst    string      // the bullet for the first item
    11  	CharItemMiddle   string      // the bullet for non-first/non-last item
    12  	CharItemVertical string      // the vertical connector from one bullet to the next
    13  	CharItemBottom   string      // the bullet for the bottom-most item
    14  	CharNewline      string      // new-line character to use
    15  	LinePrefix       string      // prefix for every single line
    16  	Name             string      // name of the Style
    17  }
    18  
    19  var (
    20  	// StyleDefault renders a List like below:
    21  	//  * Game Of Thrones
    22  	//    * Winter
    23  	//    * Is
    24  	//    * Coming
    25  	//      * This
    26  	//      * Is
    27  	//      * Known
    28  	//  * The Dark Tower
    29  	//    * The Gunslinger
    30  	StyleDefault = Style{
    31  		Format:           text.FormatDefault,
    32  		CharItemSingle:   "*",
    33  		CharItemTop:      "*",
    34  		CharItemFirst:    "*",
    35  		CharItemMiddle:   "*",
    36  		CharItemVertical: "  ",
    37  		CharItemBottom:   "*",
    38  		CharNewline:      "\n",
    39  		LinePrefix:       "",
    40  		Name:             "StyleDefault",
    41  	}
    42  
    43  	// StyleBulletCircle renders a List like below:
    44  	//  ● Game Of Thrones
    45  	//    ● Winter
    46  	//    ● Is
    47  	//    ● Coming
    48  	//      ● This
    49  	//      ● Is
    50  	//      ● Known
    51  	//  ● The Dark Tower
    52  	//    ● The Gunslinger
    53  	StyleBulletCircle = Style{
    54  		Format:           text.FormatDefault,
    55  		CharItemSingle:   "●",
    56  		CharItemTop:      "●",
    57  		CharItemFirst:    "●",
    58  		CharItemMiddle:   "●",
    59  		CharItemVertical: "  ",
    60  		CharItemBottom:   "●",
    61  		CharNewline:      "\n",
    62  		LinePrefix:       "",
    63  		Name:             "StyleBulletCircle",
    64  	}
    65  
    66  	// StyleBulletFlower renders a List like below:
    67  	//  ✽ Game Of Thrones
    68  	//    ✽ Winter
    69  	//    ✽ Is
    70  	//    ✽ Coming
    71  	//      ✽ This
    72  	//      ✽ Is
    73  	//      ✽ Known
    74  	//  ✽ The Dark Tower
    75  	//    ✽ The Gunslinger
    76  	StyleBulletFlower = Style{
    77  		Format:           text.FormatDefault,
    78  		CharItemSingle:   "✽",
    79  		CharItemTop:      "✽",
    80  		CharItemFirst:    "✽",
    81  		CharItemMiddle:   "✽",
    82  		CharItemVertical: "  ",
    83  		CharItemBottom:   "✽",
    84  		CharNewline:      "\n",
    85  		LinePrefix:       "",
    86  		Name:             "StyleBulletFlower",
    87  	}
    88  
    89  	// StyleBulletSquare renders a List like below:
    90  	//  ■ Game Of Thrones
    91  	//    ■ Winter
    92  	//    ■ Is
    93  	//    ■ Coming
    94  	//      ■ This
    95  	//      ■ Is
    96  	//      ■ Known
    97  	//  ■ The Dark Tower
    98  	//    ■ The Gunslinger
    99  	StyleBulletSquare = Style{
   100  		Format:           text.FormatDefault,
   101  		CharItemSingle:   "■",
   102  		CharItemTop:      "■",
   103  		CharItemFirst:    "■",
   104  		CharItemMiddle:   "■",
   105  		CharItemVertical: "  ",
   106  		CharItemBottom:   "■",
   107  		CharNewline:      "\n",
   108  		LinePrefix:       "",
   109  		Name:             "StyleBulletSquare",
   110  	}
   111  
   112  	// StyleBulletStar renders a List like below:
   113  	//  ★ Game Of Thrones
   114  	//    ★ Winter
   115  	//    ★ Is
   116  	//    ★ Coming
   117  	//      ★ This
   118  	//      ★ Is
   119  	//      ★ Known
   120  	//  ★ The Dark Tower
   121  	//    ★ The Gunslinger
   122  	StyleBulletStar = Style{
   123  		Format:           text.FormatDefault,
   124  		CharItemSingle:   "★",
   125  		CharItemTop:      "★",
   126  		CharItemFirst:    "★",
   127  		CharItemMiddle:   "★",
   128  		CharItemVertical: "  ",
   129  		CharItemBottom:   "★",
   130  		CharNewline:      "\n",
   131  		LinePrefix:       "",
   132  		Name:             "StyleBulletStar",
   133  	}
   134  
   135  	// StyleBulletTriangle renders a List like below:
   136  	//  ▶ Game Of Thrones
   137  	//    ▶ Winter
   138  	//    ▶ Is
   139  	//    ▶ Coming
   140  	//      ▶ This
   141  	//      ▶ Is
   142  	//      ▶ Known
   143  	//  ▶ The Dark Tower
   144  	//    ▶ The Gunslinger
   145  	StyleBulletTriangle = Style{
   146  		Format:           text.FormatDefault,
   147  		CharItemSingle:   "▶",
   148  		CharItemTop:      "▶",
   149  		CharItemFirst:    "▶",
   150  		CharItemMiddle:   "▶",
   151  		CharItemVertical: "  ",
   152  		CharItemBottom:   "▶",
   153  		CharNewline:      "\n",
   154  		LinePrefix:       "",
   155  		Name:             "StyleBulletTriangle",
   156  	}
   157  
   158  	// StyleConnectedBold renders a List like below:
   159  	//  ┏━ Game Of Thrones
   160  	//  ┃  ┣━ Winter
   161  	//  ┃  ┣━ Is
   162  	//  ┃  ┗━ Coming
   163  	//  ┃     ┣━ This
   164  	//  ┃     ┣━ Is
   165  	//  ┃     ┗━ Known
   166  	//  ┗━ The Dark Tower
   167  	//     ┗━ The Gunslinger
   168  	StyleConnectedBold = Style{
   169  		Format:           text.FormatDefault,
   170  		CharItemSingle:   "━━",
   171  		CharItemTop:      "┏━",
   172  		CharItemFirst:    "┣━",
   173  		CharItemMiddle:   "┣━",
   174  		CharItemVertical: "┃  ",
   175  		CharItemBottom:   "┗━",
   176  		CharNewline:      "\n",
   177  		LinePrefix:       "",
   178  		Name:             "StyleConnectedBold",
   179  	}
   180  
   181  	// StyleConnectedDouble renders a List like below:
   182  	//  ╔═ Game Of Thrones
   183  	//  ║  ╠═ Winter
   184  	//  ║  ╠═ Is
   185  	//  ║  ╚═ Coming
   186  	//  ║     ╠═ This
   187  	//  ║     ╠═ Is
   188  	//  ║     ╚═ Known
   189  	//  ╚═ The Dark Tower
   190  	//     ╚═ The Gunslinger
   191  	StyleConnectedDouble = Style{
   192  		Format:           text.FormatDefault,
   193  		CharItemSingle:   "══",
   194  		CharItemTop:      "╔═",
   195  		CharItemFirst:    "╠═",
   196  		CharItemMiddle:   "╠═",
   197  		CharItemVertical: "║  ",
   198  		CharItemBottom:   "╚═",
   199  		CharNewline:      "\n",
   200  		LinePrefix:       "",
   201  		Name:             "StyleConnectedDouble",
   202  	}
   203  
   204  	// StyleConnectedLight renders a List like below:
   205  	//  ┌─ Game Of Thrones
   206  	//  │  ├─ Winter
   207  	//  │  ├─ Is
   208  	//  │  └─ Coming
   209  	//  │     ├─ This
   210  	//  │     ├─ Is
   211  	//  │     └─ Known
   212  	//  └─ The Dark Tower
   213  	//     └─ The Gunslinger
   214  	StyleConnectedLight = Style{
   215  		Format:           text.FormatDefault,
   216  		CharItemSingle:   "──",
   217  		CharItemTop:      "┌─",
   218  		CharItemFirst:    "├─",
   219  		CharItemMiddle:   "├─",
   220  		CharItemVertical: "│  ",
   221  		CharItemBottom:   "└─",
   222  		CharNewline:      "\n",
   223  		LinePrefix:       "",
   224  		Name:             "StyleConnectedLight",
   225  	}
   226  
   227  	// StyleConnectedRounded renders a List like below:
   228  	//  ╭─ Game Of Thrones
   229  	//  │  ├─ Winter
   230  	//  │  ├─ Is
   231  	//  │  ╰─ Coming
   232  	//  │     ├─ This
   233  	//  │     ├─ Is
   234  	//  │     ╰─ Known
   235  	//  ╰─ The Dark Tower
   236  	//     ╰─ The Gunslinger
   237  	StyleConnectedRounded = Style{
   238  		Format:           text.FormatDefault,
   239  		CharItemSingle:   "──",
   240  		CharItemTop:      "╭─",
   241  		CharItemFirst:    "├─",
   242  		CharItemMiddle:   "├─",
   243  		CharItemVertical: "│  ",
   244  		CharItemBottom:   "╰─",
   245  		CharNewline:      "\n",
   246  		LinePrefix:       "",
   247  		Name:             "StyleConnectedRounded",
   248  	}
   249  
   250  	// StyleMarkdown renders a List like below:
   251  	//    * Game Of Thrones
   252  	//      * Winter
   253  	//      * Is
   254  	//      * Coming
   255  	//        * This
   256  	//        * Is
   257  	//        * Known
   258  	//    * The Dark Tower
   259  	//      * The Gunslinger
   260  	StyleMarkdown = Style{
   261  		Format:           text.FormatDefault,
   262  		CharItemSingle:   "*",
   263  		CharItemTop:      "*",
   264  		CharItemFirst:    "*",
   265  		CharItemMiddle:   "*",
   266  		CharItemVertical: "  ",
   267  		CharItemBottom:   "*",
   268  		CharNewline:      "<br/>",
   269  		LinePrefix:       "  ",
   270  		Name:             "StyleMarkdown",
   271  	}
   272  
   273  	// styleTest renders a List like below:
   274  	//  t Game Of Thrones
   275  	//  |f Winter
   276  	//  |m Is
   277  	//  |b Coming
   278  	//  | f This
   279  	//  | m Is
   280  	//  | b Known
   281  	//  b The Dark Tower
   282  	//   b The Gunslinger
   283  	styleTest = Style{
   284  		Format:           text.FormatDefault,
   285  		CharItemSingle:   "s",
   286  		CharItemTop:      "t",
   287  		CharItemFirst:    "f",
   288  		CharItemMiddle:   "m",
   289  		CharItemVertical: "|",
   290  		CharItemBottom:   "b",
   291  		CharNewline:      "\n",
   292  		LinePrefix:       "",
   293  		Name:             "styleTest",
   294  	}
   295  )
   296  

View as plain text