GitLabgitlab-org

cli

main
ply6 git calls32 ms97 KiB5 cachedprotocol v2
122 lines6.0 KiBRaw
1package theme
3import (
4 "image/color"
6 "charm.land/fang/v2"
7 "charm.land/huh/v2"
8 "charm.land/lipgloss/v2"
9)
11// GitLabColors contains the GitLab product color palette.
12// These colors are designed for accessibility across different terminal backgrounds.
13type GitLabColors struct {
14 // Brand colors
15 Orange color.Color // GitLab brand orange (#FC6D26)
16 Purple color.Color // GitLab brand purple (#7759C2 light, #A989F5 dark)
18 // Semantic colors
19 Blue color.Color // Blue for current/active states (#1068BF light, #4285F4 dark)
20 Green color.Color // Green for success (#217645 light, #34D058 dark)
21 Red color.Color // Red for errors (#C91C00 light, #F97583 dark)
22 Warning color.Color // Amber for warnings/caution (#C97A00 light, #E5A000 dark)
24 // Neutral colors
25 Text color.Color // High-contrast text (#171321 light, #FAFAFA dark)
26 Subtle color.Color // Subtle elements (#6B6B73 light, #B0B0B0 dark)
29// NewGitLabColors creates GitLab brand colors using lightDarkFunc for accessibility.
30// The lightDarkFunc automatically selects colors based on terminal background.
31func NewGitLabColors(lightDarkFunc lipgloss.LightDarkFunc) GitLabColors {
32 return GitLabColors{
33 Orange: lightDarkFunc(lipgloss.Color("#FC6D26"), lipgloss.Color("#FC6D26")),
34 Purple: lightDarkFunc(lipgloss.Color("#7759C2"), lipgloss.Color("#A989F5")),
35 Blue: lightDarkFunc(lipgloss.Color("#1068BF"), lipgloss.Color("#4285F4")),
36 Green: lightDarkFunc(lipgloss.Color("#217645"), lipgloss.Color("#34D058")),
37 Red: lightDarkFunc(lipgloss.Color("#C91C00"), lipgloss.Color("#F97583")),
38 Warning: lightDarkFunc(lipgloss.Color("#C97A00"), lipgloss.Color("#E5A000")),
39 Text: lightDarkFunc(lipgloss.Color("#171321"), lipgloss.Color("#FAFAFA")),
40 Subtle: lightDarkFunc(lipgloss.Color("#6B6B73"), lipgloss.Color("#B0B0B0")),
41 }
44// FangColorScheme returns a fang color scheme with GitLab product colors.
45// This maintains the existing fang styling established in the CLI.
46func FangColorScheme(lightDarkFunc lipgloss.LightDarkFunc) fang.ColorScheme {
47 colors := NewGitLabColors(lightDarkFunc)
48 scheme := fang.DefaultColorScheme(lightDarkFunc)
50 // Apply GitLab product color semantics
51 scheme.Title = colors.Text // Main command titles
52 scheme.Command = colors.Purple // Subcommands - purple for brand consistency
53 scheme.Flag = colors.Purple // Flags - purple for brand consistency
54 scheme.FlagDefault = colors.Subtle // Default flag values - subtle
55 scheme.Description = colors.Text // Command descriptions - high contrast
56 scheme.Program = colors.Orange // Program name (glab) - brand consistency
57 scheme.Argument = colors.Blue // Command arguments - blue for interactive elements
58 scheme.DimmedArgument = colors.Subtle // Optional/dimmed arguments - reduced prominence
59 scheme.QuotedString = colors.Text // Quoted strings - high contrast
60 scheme.Comment = colors.Subtle // Comments - reduced visual weight
61 scheme.Help = colors.Text // Help text - maximum readability
62 scheme.Dash = colors.Subtle // Dashes and separators - subtle structure
63 scheme.ErrorHeader = [2]color.Color{lipgloss.Color("#FFFFFF"), lipgloss.Color("#C91C00")}
64 scheme.ErrorDetails = colors.Red // Error details in GitLab red
66 return scheme
69// HuhTheme returns a huh theme with GitLab product colors.
70// This ensures consistent branding across interactive prompts.
71func HuhTheme() huh.ThemeFunc {
72 return func(isDark bool) *huh.Styles {
73 theme := huh.ThemeBase(isDark)
75 colors := NewGitLabColors(lipgloss.LightDark(isDark))
76 gitlabPurple, gitlabOrange, gitlabBlue, gitlabRed, gitlabSubtle :=
77 colors.Purple, colors.Orange, colors.Blue, colors.Red, colors.Subtle
79 // Focused field styles (when user is interacting)
80 theme.Focused.Base = theme.Focused.Base.BorderForeground(gitlabPurple)
81 theme.Focused.Title = theme.Focused.Title.Foreground(gitlabPurple).Bold(true)
82 theme.Focused.Description = theme.Focused.Description.Foreground(gitlabSubtle)
83 theme.Focused.SelectedOption = theme.Focused.SelectedOption.Foreground(gitlabBlue)
84 theme.Focused.UnselectedOption = theme.Focused.UnselectedOption.Foreground(gitlabSubtle)
85 theme.Focused.SelectedPrefix = lipgloss.NewStyle().Foreground(gitlabOrange).SetString("✓ ")
86 theme.Focused.UnselectedPrefix = lipgloss.NewStyle().Foreground(gitlabSubtle).SetString("• ")
87 theme.Focused.MultiSelectSelector = theme.Focused.MultiSelectSelector.Foreground(gitlabOrange) // MultiSelect cursor arrow
88 theme.Focused.SelectSelector = theme.Focused.SelectSelector.Foreground(gitlabOrange) // Select cursor arrow
90 // Text input styling
91 theme.Focused.TextInput.Cursor = theme.Focused.TextInput.Cursor.Foreground(gitlabOrange)
92 theme.Focused.TextInput.Placeholder = theme.Focused.TextInput.Placeholder.Foreground(gitlabSubtle)
93 theme.Focused.TextInput.Prompt = theme.Focused.TextInput.Prompt.Foreground(gitlabPurple)
95 // Blurred field styles (when not active)
96 theme.Blurred.Base = theme.Blurred.Base.BorderForeground(gitlabSubtle)
97 theme.Blurred.Title = theme.Blurred.Title.Foreground(gitlabSubtle)
98 theme.Blurred.Description = theme.Blurred.Description.Foreground(gitlabSubtle)
99 theme.Blurred.TextInput.Prompt = theme.Blurred.TextInput.Prompt.Foreground(gitlabSubtle)
101 // Confirm button styles: filled = selected, plain text = not selected.
102 // Both are single-row height; the filled orange block makes the active button obvious.
103 theme.Focused.FocusedButton = lipgloss.NewStyle().
104 Foreground(lipgloss.Color("#171321")).
105 Background(gitlabOrange).
106 Bold(true).
107 Padding(0, 2).
108 MarginRight(1)
109 theme.Focused.BlurredButton = lipgloss.NewStyle().
110 Foreground(gitlabSubtle).
111 Padding(0, 2).
112 MarginRight(1)
114 // Error styling
115 theme.Focused.ErrorIndicator = theme.Focused.ErrorIndicator.Foreground(gitlabRed)
116 theme.Focused.ErrorMessage = theme.Focused.ErrorMessage.Foreground(gitlabRed)
117 theme.Blurred.ErrorIndicator = theme.Blurred.ErrorIndicator.Foreground(gitlabRed)
118 theme.Blurred.ErrorMessage = theme.Blurred.ErrorMessage.Foreground(gitlabRed)
120 return theme
121 }
Diagnostics6 git calls · 32 ms
CallStatusSizeTime032 ms
discover200185 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB · hit2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=59849
git.response.cache=HIT
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchtree:0 · deepen 1020032 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0200138 B · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=138
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=c9c7474a68bc1a7509365732413a694e3dcc6809
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=138
git.pkt.payload.max=111
git.sideband.band1.bytes=111
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=111
git.pack.trailer=9436b0194f2ddf94a9d547d5a3dcc8d639125b9a
Open pack map
fetch2001.8 KiB · hit24 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=24
git.response.bytes=1877
git.response.cache=HIT
git.response.duration_ms=24
git.fetch.wants=45fd15cc35771ed6dfad2ade5e69553ade24af55
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1877
git.pkt.payload.max=1850
git.sideband.band1.bytes=1850
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e126763d997fd8
Request
eb7c0d77…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format