# Changing the cursor colour in Insert mode

**URL:** <https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394>\
**Category:** Recipes & Guides\
**Tags:** face\
**Created:** [March 23, 2019, 1:30am UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394 "2019-03-23T01:30:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [March 23, 2019, 1:30am UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394/1 "2019-03-23T01:30:11Z")

</div>

Inspired by [a recent GitHub issue](https://github.com/mawww/kakoune/issues/2798), I figured I’d try changing the cursor colour scheme between insert and normal mode. It was trickier than I expected, because I prefer to stick to the basic 16 terminal colours. It’s difficult to come up with a set of faces that distinguishes primary vs. secondary and cursor vs. selection in a logical way with only the basic 16 colours, and adding the normal vs. insert distinction on top makes it even harder.

Here’s what I came up with:

```
set-face global PrimarySelection white,blue+F
set-face global SecondarySelection black,blue+F
set-face global PrimaryCursor black,bright-cyan+F
set-face global SecondaryCursor black,bright-blue+F
set-face global PrimaryCursorEol black,bright-cyan
set-face global SecondaryCursorEol black,bright-blue
                                                                          
hook global ModeChange .*:insert %{
    set-face window PrimarySelection white,green+F
    set-face window SecondarySelection black,green+F
    set-face window PrimaryCursor black,bright-yellow+F
    set-face window SecondaryCursor black,bright-green+F
    set-face window PrimaryCursorEol black,bright-yellow
    set-face window SecondaryCursorEol black,bright-green
}

hook global ModeChange insert:.* %{
    unset-face window PrimarySelection
    unset-face window SecondarySelection
    unset-face window PrimaryCursor
    unset-face window SecondaryCursor
    unset-face window PrimaryCursorEol
    unset-face window SecondaryCursorEol
}

```

Basically:

- White text on colour for primary selections, black text on colour for secondary
- Black text on very bright colour for primary cursors, black text on slightly brighter colour for secondary cursors
- Normal mode uses blue, bright-blue, and bright-cyan as its dark, bright and very-bright colours, while insert mode uses green, bright-green, and bright-yellow
- No special colors for the Eol cursor variants, because I have a `show-whitespace` highlighter to make them visible instead.

It’s awkward that this scheme needs three shades of colour; if it were two, the standard 16-colour palette has plenty, and if it were four, I could maybe use a pair of two-shade cool colours and a pair of two-shade warm colours. Ah, well. I’ll use this scheme for a bit and see how I feel about it.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 25, 2019, 1:13pm UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394/2 "2019-03-25T13:13:04Z")

</div>

Can you show us a GIF or [asciicast](https://asciinema.org)?

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [March 26, 2019, 11:45am UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394/3 "2019-03-26T11:45:12Z")

</div>

Hilariously, the asciicast website doesn’t seem to support the `bright-blue` or `bright-green` colours that I use for secondary cursors (it works when played back in the terminal), but you can still get the general idea: [https://asciinema.org/a/1zeMpIvVEvvRF46tqQqZWNkO8](https://asciinema.org/a/1zeMpIvVEvvRF46tqQqZWNkO8)

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [June 22, 2021, 7:36am UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394/4 "2021-06-22T07:36:55Z")

</div>

Since I made this post years ago, Kakoune has changed the syntax of the `ModeChange` hook parameter, and the example I gave above no longer works. Here’s a fixed version:

```auto
# Shades of blue/cyan for normal mode
set-face global PrimarySelection white,blue+F
set-face global SecondarySelection black,blue+F
set-face global PrimaryCursor black,bright-cyan+F
set-face global SecondaryCursor black,bright-blue+F
set-face global PrimaryCursorEol black,bright-cyan
set-face global SecondaryCursorEol black,bright-blue

# Shades of green/yellow for insert mode.
hook global ModeChange (push|pop):.*:insert %{
    set-face window PrimarySelection white,green+F
    set-face window SecondarySelection black,green+F
    set-face window PrimaryCursor black,bright-yellow+F
    set-face window SecondaryCursor black,bright-green+F
    set-face window PrimaryCursorEol black,bright-yellow
    set-face window SecondaryCursorEol black,bright-green
}

# Undo colour changes when we leave insert mode.
hook global ModeChange (push|pop):insert:.* %{
    unset-face window PrimarySelection
    unset-face window SecondarySelection
    unset-face window PrimaryCursor
    unset-face window SecondaryCursor
    unset-face window PrimaryCursorEol
    unset-face window SecondaryCursorEol
}

```

---

<div class="post-metadata">

**Author:** ![paaloeye](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/paaloeye/32/1646_2.png) [@paaloeye](https://discuss.kakoune.com/u/paaloeye)\
**Post date:** [May 21, 2026, 5:23pm UTC](https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394/5 "2026-05-21T17:23:29Z")

</div>

Curly underline is even better!

 ![Scherm­afbeelding 2026-05-21 om 19.21.00](https://discuss.kakoune.com/uploads/default/original/2X/3/3f2bb5c75be1668191b80c4d9320ba9987495ea9.png)
