-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dedicated hyperlink example and add hyperlinks to layout example
- Loading branch information
1 parent
d5aae08
commit e8ccaaa
Showing
2 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/charmbracelet/lipgloss" | ||
) | ||
|
||
func main() { | ||
box := lipgloss.NewStyle(). | ||
Border(lipgloss.RoundedBorder()). | ||
BorderForeground(lipgloss.AdaptiveColor{Light: "#874BFD", Dark: "#7D56F4"}). | ||
Padding(2, 3). | ||
Margin(1, 0, 1, 2). | ||
Width(32). | ||
Align(lipgloss.Center) | ||
|
||
link := func(str, url string) string { | ||
return lipgloss.NewStyle(). | ||
Hyperlink(url). | ||
Foreground(lipgloss.Color("#FF5F87")). | ||
Render(str) | ||
} | ||
|
||
bodyA := fmt.Sprintf("Is it %s time?\nI think it is time.", link("maramalade", "https://www.bonne-maman.com/")) | ||
bodyB := fmt.Sprintf("Marmalade is the true power behind %s.", link("Mary Queen of Scots", "https://thetudortravelguide.com/tudor-recipes-for-the-love-of-oranges/")) | ||
|
||
fmt.Println( | ||
lipgloss.JoinHorizontal( | ||
lipgloss.Center, | ||
box.Render(bodyA), | ||
box.Render(bodyB), | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters