Download internal/ui/diffview/style.go from SaylorTwift/crush: direct link, hf CLI and curl.
- Browser
- Download file 3.99 kB
-
https://huggingface.co/SaylorTwift/crush/resolve/main/internal/ui/diffview/style.go
- Command line
-
hf download hf://SaylorTwift/crush/internal/ui/diffview/style.go
-
curl -L -o style.go https://huggingface.co/SaylorTwift/crush/resolve/main/internal/ui/diffview/style.go
3.99 kB
| package diffview | |
| import ( | |
| "charm.land/lipgloss/v2" | |
| "github.com/charmbracelet/x/exp/charmtone" | |
| ) | |
| // LineStyle defines the styles for a given line type in the diff view. | |
| type LineStyle struct { | |
| LineNumber lipgloss.Style | |
| Symbol lipgloss.Style | |
| Code lipgloss.Style | |
| } | |
| // Style defines the overall style for the diff view, including styles for | |
| // different line types such as divider, missing, equal, insert, and delete | |
| // lines. | |
| type Style struct { | |
| DividerLine LineStyle | |
| MissingLine LineStyle | |
| EqualLine LineStyle | |
| InsertLine LineStyle | |
| DeleteLine LineStyle | |
| Filename LineStyle | |
| } | |
| // DefaultLightStyle provides a default light theme style for the diff view. | |
| func DefaultLightStyle() Style { | |
| return Style{ | |
| DividerLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Iron). | |
| Background(charmtone.Thunder), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Oyster). | |
| Background(charmtone.Anchovy), | |
| }, | |
| MissingLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Background(charmtone.Sash), | |
| Code: lipgloss.NewStyle(). | |
| Background(charmtone.Sash), | |
| }, | |
| EqualLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Char). | |
| Background(charmtone.Sash), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Pepper). | |
| Background(charmtone.Salt), | |
| }, | |
| InsertLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Turtle). | |
| Background(lipgloss.Color("#c8e6c9")), | |
| Symbol: lipgloss.NewStyle(). | |
| Foreground(charmtone.Turtle). | |
| Background(lipgloss.Color("#e8f5e9")), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Pepper). | |
| Background(lipgloss.Color("#e8f5e9")), | |
| }, | |
| DeleteLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Cherry). | |
| Background(lipgloss.Color("#ffcdd2")), | |
| Symbol: lipgloss.NewStyle(). | |
| Foreground(charmtone.Cherry). | |
| Background(lipgloss.Color("#ffebee")), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Pepper). | |
| Background(lipgloss.Color("#ffebee")), | |
| }, | |
| Filename: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Iron). | |
| Background(charmtone.Thunder), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Iron). | |
| Background(charmtone.Thunder), | |
| }, | |
| } | |
| } | |
| // DefaultDarkStyle provides a default dark theme style for the diff view. | |
| func DefaultDarkStyle() Style { | |
| return Style{ | |
| DividerLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Smoke). | |
| Background(charmtone.Sapphire), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Smoke). | |
| Background(charmtone.Ox), | |
| }, | |
| MissingLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Background(charmtone.Char), | |
| Code: lipgloss.NewStyle(). | |
| Background(charmtone.Char), | |
| }, | |
| EqualLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Sash). | |
| Background(charmtone.Char), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Salt). | |
| Background(charmtone.Pepper), | |
| }, | |
| InsertLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Turtle). | |
| Background(lipgloss.Color("#293229")), | |
| Symbol: lipgloss.NewStyle(). | |
| Foreground(charmtone.Turtle). | |
| Background(lipgloss.Color("#303a30")), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Salt). | |
| Background(lipgloss.Color("#303a30")), | |
| }, | |
| DeleteLine: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Cherry). | |
| Background(lipgloss.Color("#332929")), | |
| Symbol: lipgloss.NewStyle(). | |
| Foreground(charmtone.Cherry). | |
| Background(lipgloss.Color("#3a3030")), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Salt). | |
| Background(lipgloss.Color("#3a3030")), | |
| }, | |
| Filename: LineStyle{ | |
| LineNumber: lipgloss.NewStyle(). | |
| Foreground(charmtone.Smoke). | |
| Background(charmtone.Sapphire), | |
| Code: lipgloss.NewStyle(). | |
| Foreground(charmtone.Smoke). | |
| Background(charmtone.Sapphire), | |
| }, | |
| } | |
| } | |