detached a47fd09

fix(theme): clear RGB pulse fallback

commit
a47fd09a8f7126727448403e8278978b586a228f
author
brice · · 2026-07-17 10:38 UTC
parent
bd7ecc4
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +17 -2
M internal/usecase/theme/styles.go +1 -0
@@ -40,6 +40,7 @@ func PulseColor(base renderer.Style, intensity float64) renderer.Style {
4040 if base.HasForegroundRGB && base.HasBackgroundRGB {
4141 style.ForegroundRGB = Blend(base.BackgroundRGB, base.ForegroundRGB, intensity)
4242 } else {
43+ style.HasForegroundRGB = false
4344 style.Foreground = 244 + int(intensity*11)
4445 }
4546 return style
@@ -40,6 +40,7 @@ func PulseColor(base renderer.Style, intensity float64) renderer.Style {
40 if base.HasForegroundRGB && base.HasBackgroundRGB {40 if base.HasForegroundRGB && base.HasBackgroundRGB {
41 style.ForegroundRGB = Blend(base.BackgroundRGB, base.ForegroundRGB, intensity)41 style.ForegroundRGB = Blend(base.BackgroundRGB, base.ForegroundRGB, intensity)
42 } else {42 } else {
43+ style.HasForegroundRGB = false
43 style.Foreground = 244 + int(intensity*11)44 style.Foreground = 244 + int(intensity*11)
44 }45 }
45 return style46 return style
M internal/usecase/theme/styles_test.go +14 -0
@@ -59,6 +59,8 @@ func TestPulseColor(t *testing.T) {
5959 HasUnderlineColorRGB: false,
6060 }
6161 indexedBase := renderer.Style{Foreground: -1, Background: -1, Inverse: true}
62+ mixedBase := rgbBase
63+ mixedBase.HasBackgroundRGB = false
6264
6365 tests := []struct {
6466 name string
@@ -98,6 +100,18 @@ func TestPulseColor(t *testing.T) {
98100 return style
99101 }(),
100102 },
103+ {
104+ name: "RGB foreground without RGB background uses indexed grayscale",
105+ base: mixedBase,
106+ intensity: 0.5,
107+ want: func() renderer.Style {
108+ style := mixedBase
109+ style.Bold = true
110+ style.HasForegroundRGB = false
111+ style.Foreground = 249
112+ return style
113+ }(),
114+ },
101115 {
102116 name: "indexed color uses xterm grayscale start",
103117 base: indexedBase,
@@ -59,6 +59,8 @@ func TestPulseColor(t *testing.T) {
59 HasUnderlineColorRGB: false,59 HasUnderlineColorRGB: false,
60 }60 }
61 indexedBase := renderer.Style{Foreground: -1, Background: -1, Inverse: true}61 indexedBase := renderer.Style{Foreground: -1, Background: -1, Inverse: true}
62+ mixedBase := rgbBase
63+ mixedBase.HasBackgroundRGB = false
62 64
63 tests := []struct {65 tests := []struct {
64 name string66 name string
@@ -98,6 +100,18 @@ func TestPulseColor(t *testing.T) {
98 return style100 return style
99 }(),101 }(),
100 },102 },
103+ {
104+ name: "RGB foreground without RGB background uses indexed grayscale",
105+ base: mixedBase,
106+ intensity: 0.5,
107+ want: func() renderer.Style {
108+ style := mixedBase
109+ style.Bold = true
110+ style.HasForegroundRGB = false
111+ style.Foreground = 249
112+ return style
113+ }(),
114+ },
101 {115 {
102 name: "indexed color uses xterm grayscale start",116 name: "indexed color uses xterm grayscale start",
103 base: indexedBase,117 base: indexedBase,
M internal/usecase/theme/theme.go +2 -2
@@ -107,8 +107,8 @@ func parseXColorComponent(s string) (uint8, bool) {
107107 if err != nil {
108108 return 0, false
109109 }
110- max := uint64((1 << (4 * len(s))) - 1)
111- return uint8(value * 255 / max), true
110+ maxValue := uint64((1 << (4 * len(s))) - 1)
111+ return uint8(value * 255 / maxValue), true
112112 }
113113
114114 func parseHexByte(s string) (uint8, bool) {
@@ -107,8 +107,8 @@ func parseXColorComponent(s string) (uint8, bool) {
107 if err != nil {107 if err != nil {
108 return 0, false108 return 0, false
109 }109 }
110- max := uint64((1 << (4 * len(s))) - 1)110+ maxValue := uint64((1 << (4 * len(s))) - 1)
111- return uint8(value * 255 / max), true111+ return uint8(value * 255 / maxValue), true
112 }112 }
113 113
114 func parseHexByte(s string) (uint8, bool) {114 func parseHexByte(s string) (uint8, bool) {

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 12

Tags 11

↑↓ moveenter openesc close