Skip to content

Commit 86da9f4

Browse files
Add userColor3 and userColor4 hat colors (#3206)
## Add userColor3 and userColor4 hat colors ### Summary Add two additional user-configurable hat colors (`userColor3` and `userColor4`) to Cursorless. Currently only 2 user-defined colors exist (`userColor1`/navy and `userColor2`/apricot), I use 4 colors and as a result am building the extension locally from my personal fork. Would be great if that step wasn't necessary. ### Changes - **Talon**: Added `userColor3` and `userColor4` to color enablement defaults and spoken forms (`cursorless-talon/src/marks/decorated_mark.py`, `cursorless-talon/src/spoken_forms.json`) - **Type definitions**: Extended `HatColor` union type in all legacy command type files (V0V1, V2, V3) - **Spoken form generation**: Added default spoken form mappings for the new colors (`cursorless-engine/src/generateSpokenForm/defaultSpokenForms/marks.ts`) - **VS Code extension**: Added the new colors to all relevant `package.json` settings — light/dark color values, hat enablement booleans, hat penalties, and color enum list. Default colors: olive green (`#6b8e23`) and light gray (`#e0e0e0`) - **Hat styles**: Added to the `HAT_COLORS` const array (`hatStyles.types.ts`) - **Docs**: Updated the user-facing color table in `README.md` Both new colors are **disabled by default**, matching the pattern of `userColor1`/`userColor2`. ## Test plan - [x] Verify VS Code loads without errors with default settings - [x] Enable `userColor3` and `userColor4` in settings and confirm hats render with the configured colors - [ ] Assign custom spoken form names to the new colors (e.g., "white" → `userColor3`, "black" → `userColor4`) since the defaults are placeholder names — users must name their colors to use them - [x] Confirm existing colors (including userColor1/userColor2) are unaffected - [x] Run existing test suite --------- Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
1 parent baff848 commit 86da9f4

9 files changed

Lines changed: 69 additions & 19 deletions

File tree

cursorless-talon/src/marks/decorated_mark.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def cursorless_decorated_symbol(m) -> DecoratedSymbol:
5151
"yellow": True,
5252
"userColor1": False,
5353
"userColor2": False,
54+
"userColor3": False,
55+
"userColor4": False,
5456
}
5557

5658
DEFAULT_SHAPE_ENABLEMENT = {

cursorless-talon/src/spoken_forms.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,9 @@
245245
"pink": "pink",
246246
"yellow": "yellow",
247247
"navy": "userColor1",
248-
"apricot": "userColor2"
248+
"apricot": "userColor2",
249+
"user color three": "userColor3",
250+
"user color four": "userColor4"
249251
},
250252
"hat_shape": {
251253
"ex": "ex",

packages/common/src/types/command/legacy/CommandV0V1.types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ type HatColor =
120120
| "pink"
121121
| "yellow"
122122
| "userColor1"
123-
| "userColor2";
123+
| "userColor2"
124+
| "userColor3"
125+
| "userColor4";
124126
type HatNonDefaultShape =
125127
| "ex"
126128
| "fox"

packages/common/src/types/command/legacy/PartialTargetDescriptorV3.types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ type HatColor =
66
| "pink"
77
| "yellow"
88
| "userColor1"
9-
| "userColor2";
9+
| "userColor2"
10+
| "userColor3"
11+
| "userColor4";
1012
type HatNonDefaultShape =
1113
| "ex"
1214
| "fox"

packages/common/src/types/command/legacy/targetDescriptorV2.types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ type HatColor =
66
| "pink"
77
| "yellow"
88
| "userColor1"
9-
| "userColor2";
9+
| "userColor2"
10+
| "userColor3"
11+
| "userColor4";
1012
type HatNonDefaultShape =
1113
| "ex"
1214
| "fox"

packages/cursorless-engine/src/generateSpokenForm/defaultSpokenForms/marks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const hatColors: Record<string, string | null> = {
88
yellow: "yellow",
99
userColor1: "navy",
1010
userColor2: "apricot",
11+
userColor3: "user color three",
12+
userColor4: "user color four",
1113

1214
default: null,
1315
};

packages/cursorless-org-docs/src/docs/user/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,18 @@ Combining this with an action, we might say `"take blue air"` to select the toke
5353

5454
The following colors are supported. Note that to target the default (gray) hat you don't need to specify a color.
5555

56-
| Spoken form | Color | Internal ID | Enabled by default? |
57-
| ----------- | ------- | ------------ | ------------------- |
58-
| N/A | grey | `default` ||
59-
| `"blue"` | blue | `blue` ||
60-
| `"green"` | green | `green` ||
61-
| `"red"` | red | `red` ||
62-
| `"pink"` | pink | `pink` ||
63-
| `"yellow"` | yellow | `yellow` ||
64-
| `"navy"` | navy | `userColor1` ||
65-
| `"apricot"` | apricot | `userColor2` ||
56+
| Spoken form | Color | Internal ID | Enabled by default? |
57+
| ---------------- | ------- | ------------ | ------------------- |
58+
| N/A | grey | `default` ||
59+
| `"blue"` | blue | `blue` ||
60+
| `"green"` | green | `green` ||
61+
| `"red"` | red | `red` ||
62+
| `"pink"` | pink | `pink` ||
63+
| `"yellow"` | yellow | `yellow` ||
64+
| `"navy"` | navy | `userColor1` ||
65+
| `"apricot"` | apricot | `userColor2` ||
66+
| `"user color 3"` | user 3 | `userColor3` ||
67+
| `"user color 4"` | user 4 | `userColor4` ||
6668

6769
You can enable or disable colors in your VSCode settings, by searching for [`cursorless.hatEnablement.colors`](vscode://settings/cursorless.hatEnablement.colors) and checking the box next to the internal ID for the given shape as listed above. To navigate to your VSCode settings, either say "show settings", or go to File --> Preferences --> Settings.
6870

packages/cursorless-vscode/package.json

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,12 @@
427427
},
428428
"userColor2": {
429429
"type": "string"
430+
},
431+
"userColor3": {
432+
"type": "string"
433+
},
434+
"userColor4": {
435+
"type": "string"
430436
}
431437
},
432438
"default": {
@@ -437,7 +443,9 @@
437443
"pink": "#E06CAA",
438444
"yellow": "#E5C02C",
439445
"userColor1": "#6a00ff",
440-
"userColor2": "#ffd8b1"
446+
"userColor2": "#ffd8b1",
447+
"userColor3": "#6b8e23",
448+
"userColor4": "#e0e0e0"
441449
},
442450
"additionalProperties": false
443451
},
@@ -469,6 +477,12 @@
469477
},
470478
"userColor2": {
471479
"type": "string"
480+
},
481+
"userColor3": {
482+
"type": "string"
483+
},
484+
"userColor4": {
485+
"type": "string"
472486
}
473487
},
474488
"default": {
@@ -479,7 +493,9 @@
479493
"pink": "#e0679f",
480494
"yellow": "#edb62b",
481495
"userColor1": "#6a00ff",
482-
"userColor2": "#ffd8b1"
496+
"userColor2": "#ffd8b1",
497+
"userColor3": "#6b8e23",
498+
"userColor4": "#e0e0e0"
483499
},
484500
"additionalProperties": false
485501
},
@@ -700,6 +716,12 @@
700716
},
701717
"userColor2": {
702718
"type": "boolean"
719+
},
720+
"userColor3": {
721+
"type": "boolean"
722+
},
723+
"userColor4": {
724+
"type": "boolean"
703725
}
704726
},
705727
"default": {
@@ -709,7 +731,9 @@
709731
"pink": true,
710732
"yellow": true,
711733
"userColor1": false,
712-
"userColor2": false
734+
"userColor2": false,
735+
"userColor3": false,
736+
"userColor4": false
713737
},
714738
"additionalProperties": false
715739
},
@@ -792,6 +816,12 @@
792816
},
793817
"userColor2": {
794818
"type": "number"
819+
},
820+
"userColor3": {
821+
"type": "number"
822+
},
823+
"userColor4": {
824+
"type": "number"
795825
}
796826
},
797827
"default": {
@@ -801,7 +831,9 @@
801831
"pink": 1,
802832
"yellow": 1,
803833
"userColor1": 1,
804-
"userColor2": 1
834+
"userColor2": 1,
835+
"userColor3": 1,
836+
"userColor4": 1
805837
},
806838
"additionalProperties": false
807839
},
@@ -1106,7 +1138,9 @@
11061138
"pink",
11071139
"yellow",
11081140
"userColor1",
1109-
"userColor2"
1141+
"userColor2",
1142+
"userColor3",
1143+
"userColor4"
11101144
]
11111145
}
11121146
},

packages/cursorless-vscode/src/ide/vscode/hatStyles.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export const HAT_COLORS = [
77
"yellow",
88
"userColor1",
99
"userColor2",
10+
"userColor3",
11+
"userColor4",
1012
] as const;
1113

1214
export const HAT_NON_DEFAULT_SHAPES = [

0 commit comments

Comments
 (0)