Skip to content

Commit

Permalink
docs: readme updates
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed May 13, 2024
1 parent a6c50ff commit 457fc95
Showing 1 changed file with 19 additions and 31 deletions.
50 changes: 19 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Lip Gloss
=========
# Lip Gloss

<p>
<img src="https://stuff.charm.sh/lipgloss/lipgloss-header-github.png" width="340" alt="Lip Gloss Title Treatment"><br>
<a href="https://stuff.charm.sh/lipgloss/lipgloss-mascot-2k.png"><img width="340" alt="Lip Gloss title treatment" src="https://github.com/charmbracelet/lipgloss/assets/25087/147cadb1-4254-43ec-ae6b-8d6ca7b029a1"></a><br>
<a href="https://github.com/charmbracelet/lipgloss/releases"><img src="https://img.shields.io/github/release/charmbracelet/lipgloss.svg" alt="Latest Release"></a>
<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 @@ -64,7 +64,6 @@ The terminal's color profile will be automatically detected, and colors outside
the gamut of the current palette will be automatically coerced to their closest
available value.


### Adaptive Colors

You can also specify color options for light and dark backgrounds:
Expand Down Expand Up @@ -115,7 +114,6 @@ var style = lipgloss.NewStyle().
Reverse(true)
```


## Block-Level Formatting

Lip Gloss also supports rules for block-level formatting:
Expand Down Expand Up @@ -154,7 +152,6 @@ lipgloss.NewStyle().Padding(1, 4, 2)
lipgloss.NewStyle().Margin(2, 4, 3, 1)
```


## Aligning Text

You can align paragraphs of text to the left, right, or center.
Expand All @@ -167,7 +164,6 @@ var style = lipgloss.NewStyle().
Align(lipgloss.Center) // just kidding, align it in the center
```


## Width and Height

Setting a minimum width and height is simple and straightforward.
Expand All @@ -180,7 +176,6 @@ var style = lipgloss.NewStyle().
Foreground(lipgloss.Color("63"))
```


## Borders

Adding borders is easy:
Expand Down Expand Up @@ -228,21 +223,22 @@ lipgloss.NewStyle().

For more on borders see [the docs][docs].


## Copying Styles

Just use `Copy()`:
Just use assignment:

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

var wildStyle = style.Copy().Blink(true)
```
copiedStyle := style // this is a true copy

`Copy()` performs a copy on the underlying data structure ensuring that you get
a true, dereferenced copy of a style. Without copying, it's possible to mutate
styles.
wildStyle := style.Blink(true) // this is also true copy, with blink added

```

Since `Style` data structures contains only primitive types, assigning a style
to another effectively creates a new copy of the style without mutating the
original.

## Inheritance

Expand All @@ -261,7 +257,6 @@ var styleB = lipgloss.NewStyle().
Inherit(styleA)
```


## Unsetting Rules

All rules can be unset:
Expand All @@ -276,7 +271,6 @@ var style = lipgloss.NewStyle().

When a rule is unset, it won't be inherited or copied.


## Enforcing Rules

Sometimes, such as when developing a component, you want to make sure style
Expand Down Expand Up @@ -353,7 +347,6 @@ For an example on using a custom renderer over SSH with [Wish][wish] see the
In addition to pure styling, Lip Gloss also ships with some utilities to help
assemble your layouts.


### Joining Paragraphs

Horizontally and vertically joining paragraphs is a cinch.
Expand All @@ -370,7 +363,6 @@ lipgloss.JoinVertical(lipgloss.Center, paragraphA, paragraphB)
lipgloss.JoinHorizontal(0.2, paragraphA, paragraphB, paragraphC)
```


### Measuring Width and Height

Sometimes you’ll want to know the width and height of text blocks when building
Expand Down Expand Up @@ -663,8 +655,7 @@ for i := 0; i < repeat; i++ {
l.Item("Lip Gloss")
}
```

***
---

## FAQ

Expand Down Expand Up @@ -700,10 +691,11 @@ import (
lipgloss.SetColorProfile(termenv.TrueColor)
```

*Note:* this option limits the flexibility of your application and can cause
_Note:_ this option limits the flexibility of your application and can cause
ANSI escape codes to be output in cases where that might not be desired. Take
careful note of your use case and environment before choosing to force a color
profile.

</details>

## What about [Bubble Tea][tea]?
Expand All @@ -717,7 +709,6 @@ In simple terms, you can use Lip Gloss to help build your Bubble Tea views.

[tea]: https://github.com/charmbracelet/tea


## Under the Hood

Lip Gloss is built on the excellent [Termenv][termenv] and [Reflow][reflow]
Expand All @@ -727,7 +718,6 @@ For many use cases Termenv and Reflow will be sufficient for your needs.
[termenv]: https://github.com/muesli/termenv
[reflow]: https://github.com/muesli/reflow


## Rendering Markdown

For a more document-centric rendering solution with support for things like
Expand All @@ -736,28 +726,26 @@ the stylesheet-based Markdown renderer.

[glamour]: https://github.com/charmbracelet/glamour


## Feedback

We’d love to hear your thoughts on this project. Feel free to drop us a note!

* [Twitter](https://twitter.com/charmcli)
* [The Fediverse](https://mastodon.social/@charmcli)
* [Discord](https://charm.sh/chat)
- [Twitter](https://twitter.com/charmcli)
- [The Fediverse](https://mastodon.social/@charmcli)
- [Discord](https://charm.sh/chat)

## License

[MIT](https://github.com/charmbracelet/lipgloss/raw/master/LICENSE)

***
---

Part of [Charm](https://charm.sh).

<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a>

Charm热爱开源 • Charm loves open source


[docs]: https://pkg.go.dev/github.com/charmbracelet/lipgloss?tab=doc
[wish]: https://github.com/charmbracelet/wish
[ssh-example]: examples/ssh

0 comments on commit 457fc95

Please sign in to comment.