main 5041353

mode_legend_css.go RawHistoryFolder

1package theme
2
3import (
4	"fmt"
5	"strings"
6)
7
8// modeLegendColors maps legend mode classes to the palette variables of their mode.
9var modeLegendColors = []struct{ mode, color, text string }{
10	{"pane", "--pane-mode-color", "--pane-mode-text"},
11	{"vim", "--vim-mode-color", "--vim-mode-text"},
12	{"resize", "--resize-mode-color", "--resize-mode-text"},
13	{"tab", "--tab-mode-color", "--tab-mode-text"},
14	{"session", "--session-mode-color", "--session-mode-text"},
15	{"prefix", "--pane-mode-color", "--pane-mode-text"},
16}
17
18func generateModeLegendCSS() string {
19	var sb strings.Builder
20	sb.WriteString(`/* Mode toaster: a bottom-left pill whose legend expands above it. The legend
21   is an omnibox surface tinted with the active mode color. */
22.mode-legend-anchor { background-color: transparent; }
23.mode-toaster-pill {
24	border-radius: 0.25em;
25	padding: 0.375em 0.625em;
26	font-size: 0.875em;
27	font-weight: 600;
28	box-shadow: 0 2px 8px alpha(black, 0.3);
29	min-width: 2.5em;
30}
31.mode-toaster-chevron { margin-left: 0.5em; font-size: 0.75em; opacity: 0.85; }
32.mode-toaster-pill.mode-toaster-interactive:hover { box-shadow: 0 2px 10px alpha(black, 0.45); }
33.mode-toaster-pill.mode-toaster-interactive:hover .mode-toaster-chevron { opacity: 1; }
34.omnibox-container.mode-legend-panel {
35	border-style: solid;
36	border-width: 0.125em;
37	padding: 0.625em 0.5em 0.375em 0.5em;
38	min-width: 0;
39	animation: mode-legend-appear 120ms ease-out;
40}
41.omnibox-container.mode-legend-panel.mode-legend-lingering { opacity: 0.85; }
42.omnibox-container.mode-legend-panel.mode-legend-no-motion { animation: none; }
43.mode-legend-hint {
44	font-family: var(--font-mono);
45	font-size: 0.6875em;
46	color: var(--surface-muted);
47	margin: 0.25em 0.5em 0 0;
48}
49.mode-legend-columns { padding: 0 0.25em; }
50.mode-legend-column { min-width: 0; }
51.mode-legend-group { margin: 0 0.375em 0.5em 0.375em; min-width: 0; }
52.mode-legend-group-title {
53	font-family: var(--font-mono);
54	font-size: 0.6875em;
55	font-weight: bold;
56	margin-bottom: 0.25em;
57}
58.mode-legend-row { padding: 0.125em 0; min-width: 0; }
59.mode-legend-keycap {
60	font-family: var(--font-mono);
61	font-size: 0.75em;
62	font-weight: bold;
63	color: var(--control-text);
64	background-color: var(--surface-variant);
65	border-style: solid;
66	border-width: 0.0625em;
67	border-radius: 0.25em;
68	padding: 0.125em 0.375em;
69	margin-right: 0.375em;
70	transition: background-color 120ms ease-out, color 120ms ease-out;
71}
72.mode-legend-description { font-size: 0.75em; color: var(--surface-muted); }
73.mode-legend-row.mode-legend-dim { opacity: 0.3; }
74@keyframes mode-legend-appear {
75	from { opacity: 0; }
76	to { opacity: 1; }
77}
78`)
79	for _, m := range modeLegendColors {
80		fmt.Fprintf(&sb, `.omnibox-container.mode-legend-panel.mode-legend-%[1]s { border-color: var(%[2]s); }
81.mode-toaster-pill.mode-toaster-%[1]s { background-color: var(%[2]s); color: var(%[3]s); }
82.mode-legend-%[1]s .mode-legend-group-title { color: var(%[2]s); }
83.mode-legend-%[1]s .mode-legend-keycap { border-color: alpha(var(%[2]s), 0.6); }
84.mode-legend-%[1]s .mode-legend-keycap.mode-legend-flash { background-color: var(%[2]s); color: var(%[3]s); }
85`, m.mode, m.color, m.text)
86	}
87	return sb.String()
88}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close