aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-01-15 23:07:05 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-26 00:20:43 +0100
commita8b6693f7e7bdcc8b73c3fa0baa0ef5f51993dc7 (patch)
tree17b0544619e4211ef2ca06528e9377380d292a2b
parent31bc8cdad990f53ed061cf5b56a3601f1ab741d1 (diff)
downloadaerc-a8b6693f7e7bdcc8b73c3fa0baa0ef5f51993dc7.tar.gz
stylesets: add support for dim text
Allow defining <obj>.dim=true to turn on half-bright text. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
-rw-r--r--config/style.go14
-rw-r--r--doc/aerc-stylesets.7.scd4
2 files changed, 17 insertions, 1 deletions
diff --git a/config/style.go b/config/style.go
index 3e4a9597..5ce2c1cf 100644
--- a/config/style.go
+++ b/config/style.go
@@ -106,6 +106,7 @@ type Style struct {
Underline bool
Reverse bool
Italic bool
+ Dim bool
}
func (s Style) Get() tcell.Style {
@@ -116,7 +117,8 @@ func (s Style) Get() tcell.Style {
Blink(s.Blink).
Underline(s.Underline).
Reverse(s.Reverse).
- Italic(s.Italic)
+ Italic(s.Italic).
+ Dim(s.Dim)
}
func (s *Style) Normal() {
@@ -125,6 +127,7 @@ func (s *Style) Normal() {
s.Underline = false
s.Reverse = false
s.Italic = false
+ s.Dim = false
}
func (s *Style) Default() *Style {
@@ -200,6 +203,12 @@ func (s *Style) Set(attr, val string) error {
} else {
s.Italic = state
}
+ case "dim":
+ if state, err := boolSwitch(val, s.Dim); err != nil {
+ return err
+ } else {
+ s.Dim = state
+ }
case "default":
s.Default()
case "normal":
@@ -235,6 +244,9 @@ func (s Style) composeWith(styles []*Style) Style {
if st.Italic != s.Italic {
newStyle.Italic = st.Italic
}
+ if st.Dim != s.Dim {
+ newStyle.Dim = st.Dim
+ }
}
return newStyle
}
diff --git a/doc/aerc-stylesets.7.scd b/doc/aerc-stylesets.7.scd
index 2ccadd60..1303787c 100644
--- a/doc/aerc-stylesets.7.scd
+++ b/doc/aerc-stylesets.7.scd
@@ -47,6 +47,10 @@ style objects.
The italic attribute of the style object is set/unset.
The terminal needs to support italic text.
+*<object>*.*dim* = _true_|_false_|_toggle_
+ The dim attribute of the style object is set/unset.
+ The terminal needs to support half-bright text.
+
*<object>*.*reverse* = _true_|_false_|_toggle_
Reverses the color of the style object. Exchanges the foreground
and background colors.