Skip to content

Commit 85a58ce

Browse files
committed
background tint by default
1 parent 7bd5734 commit 85a58ce

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

README.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,54 @@
11
# Synesthesia
2-
### Sense your projects as iTerm2 tab colours
2+
### Sense your projects as terminal colours
33

4-
Synesthesia updates your iTerm2 tab colours depending on the go module name in your directory ancestry.
4+
Synesthesia updates your terminal tab and background colours depending on the go module name in your directory ancestry.
55

6-
Supports tinting the background with `--background-tint` and worktrees by default
6+
- **iTerm2**: Automatically updates the tab colour.
7+
- **Ghostty & Others**: Lightly tints the terminal background (enabled by default).
8+
9+
If you use git worktrees (or jj workspaces), then each copy of the same project will have a different but consistent colour.
710

811
# Installation
912
### 1. Install from source using golang 1.25
1013

11-
```
14+
```bash
1215
go install github.com/roryq/synesthesia@latest
1316
```
1417

15-
### 2. Then configure a hook for your shell.
16-
### fish
18+
### 2. Configure a hook for your shell
19+
20+
#### fish
1721
Add the following line to your `~/.config/fish/config.fish`:
1822
```fish
19-
synesthesia hook fish --background-tint | source
23+
synesthesia hook fish | source
2024
```
2125

22-
### zsh
23-
Add the following line to your `~/.zshrc`
26+
#### zsh
27+
Add the following line to your `~/.zshrc`:
2428
```zsh
25-
eval "$(synesthesia hook zsh --background-tint)"
29+
eval "$(synesthesia hook zsh)"
2630
```
2731

2832
# Usage
29-
Navigate between your directories as usual. When you have multiple tabs open for different go projects,
30-
a consistent random colour will be chosen for any tabs with the same go module name.
33+
Navigate between your directories as usual. When you have multiple tabs open for different projects,
34+
a consistent random colour will be chosen for any tabs with the same project name.
3135

32-
If you use git worktrees (or jj workspaces), then each copy of the same project will have a different but consistent colour.
36+
### Sense Custom Text
37+
You can sense a colour for any custom string (useful for agent names or specific project labels):
38+
```bash
39+
synesthesia sense "my-project-label"
40+
```
41+
42+
### Background Tinting
43+
Background tinting is enabled by default. To disable it, use the `--no-background-tint` flag:
44+
```bash
45+
synesthesia --no-background-tint
46+
```
47+
48+
To generate a hook with tinting disabled:
49+
```bash
50+
synesthesia hook zsh --no-background-tint
51+
```
3352

3453
![](demo.gif)
3554

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var cli struct {
2525
Sense struct {
2626
Text string `arg help:"Custom text to sense a color from."`
2727
} `cmd help:"Sense a color from custom text."`
28-
BackgroundTint bool `help:"Enable background tinting for Ghostty and other terminals."`
28+
BackgroundTint bool `default:"true" negatable:"" help:"Enable or disable background tinting for Ghostty and other terminals."`
2929
}
3030

3131
func main() {
@@ -34,7 +34,7 @@ func main() {
3434
kong.Description("Change iTerm2 tab colour based on go module name or custom text."),
3535
)
3636

37-
switch c := ktx.Command(); c {
37+
switch ktx.Command() {
3838
case "hook <shell>":
3939
echoHook(cli.Hook.Shell, cli.BackgroundTint)
4040
case "sense <text>":
@@ -174,7 +174,7 @@ func echoHook(shell string, enableTint bool) {
174174
bytes, _ := hooks.ReadFile(fmt.Sprintf("hooks/hook.%s", s))
175175
script := string(bytes)
176176
if !enableTint {
177-
script = strings.ReplaceAll(script, " --background-tint", "")
177+
script = strings.ReplaceAll(script, "--background-tint", "--no-background-tint")
178178
}
179179
fmt.Print(script)
180180
default:

0 commit comments

Comments
 (0)