Skip to content

Commit

Permalink
fix(example): remove deprecated NewRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Jun 18, 2024
1 parent a724723 commit 86b854c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
4 changes: 1 addition & 3 deletions examples/table/chess/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package main

import (
"fmt"
"os"
"strings"

"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/table"
)

func main() {
re := lipgloss.NewRenderer(os.Stdout)
labelStyle := re.NewStyle().Foreground(lipgloss.Color("241"))
labelStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("241"))

board := [][]string{
{"♜", "♞", "♝", "♛", "♚", "♝", "♞", "♜"},
Expand Down
7 changes: 2 additions & 5 deletions examples/table/languages/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"
"os"

"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/table"
Expand All @@ -15,13 +14,11 @@ const (
)

func main() {
re := lipgloss.NewRenderer(os.Stdout)

var (
// HeaderStyle is the lipgloss style used for the table headers.
HeaderStyle = re.NewStyle().Foreground(purple).Bold(true).Align(lipgloss.Center)
HeaderStyle = lipgloss.NewStyle().Foreground(purple).Bold(true).Align(lipgloss.Center)
// CellStyle is the base lipgloss style used for the table rows.
CellStyle = re.NewStyle().Padding(0, 1).Width(14)
CellStyle = lipgloss.NewStyle().Padding(0, 1).Width(14)
// OddRowStyle is the lipgloss style used for odd-numbered table rows.
OddRowStyle = CellStyle.Foreground(gray)
// EvenRowStyle is the lipgloss style used for even-numbered table rows.
Expand Down
6 changes: 2 additions & 4 deletions examples/table/mindy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package main

import (
"fmt"
"os"

"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/table"
)

func main() {
re := lipgloss.NewRenderer(os.Stdout)
labelStyle := re.NewStyle().Width(3).Align(lipgloss.Right)
swatchStyle := re.NewStyle().Width(6)
labelStyle := lipgloss.NewStyle().Width(3).Align(lipgloss.Right)
swatchStyle := lipgloss.NewStyle().Width(6)

data := [][]string{}
for i := 0; i < 13; i += 8 {
Expand Down

0 comments on commit 86b854c

Please sign in to comment.