Skip to content

Commit

Permalink
chore(docs): doc updates with regard to style.Copy() deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed May 6, 2024
1 parent 517b1a1 commit 2f7e779
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -6,7 +6,6 @@
<a href="https://pkg.go.dev/github.com/charmbracelet/lipgloss?tab=doc"><img src="https://godoc.org/github.com/golang/gddo?status.svg" alt="GoDoc"></a>
<a href="https://github.com/charmbracelet/lipgloss/actions"><img src="https://github.com/charmbracelet/lipgloss/workflows/build/badge.svg" alt="Build Status"></a>
<a href="https://www.phorm.ai/query?projectId=a0e324b6-b706-4546-b951-6671ea60c13f"><img src="https://stuff.charm.sh/misc/phorm-badge.svg" alt="phorm.ai"></a>

</p>

Style definitions for nice terminal layouts. Built with TUIs in mind.
Expand Down Expand Up @@ -226,12 +225,15 @@ For more on borders see [the docs][docs].

## Copying Styles

Just use assignment
Just use assignment:

```go
var style = lipgloss.NewStyle().Foreground(lipgloss.Color("219"))
style := lipgloss.NewStyle().Foreground(lipgloss.Color("219"))

copiedStyle := style // this is a true copy

wildStyle := style.Blink(true) // this is also true copy, with blink added

var wildStyle = style.Blink(true)
```

Since `Style` data structures contains only primitive types, assigning a style
Expand Down
2 changes: 1 addition & 1 deletion style.go
Expand Up @@ -189,7 +189,7 @@ func (s Style) String() string {

// Copy returns a copy of this style, including any underlying string values.
//
// Deprecated: Copy is deprecated and will be removed in a future release.
// Deprecated: to copy just use assignment (i.e. a := b). All methods also return a new style.
func (s Style) Copy() Style {
return s
}
Expand Down

0 comments on commit 2f7e779

Please sign in to comment.