summary refs log tree commit diff
path: root/claude/hooks/register.ts
blob: 6c7b7d933e573f950cb26423a91d65ed9a1e9764 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { Register, ThemeSetArgs } from 'claude-code'

import { makeColors } from './make-colors.js'

// luxnox palette from ~/Projects/luxnox/palette.toml. Flat like the GTK
// themes: pure white / pure black page, nox's raised surfaces from its
// line/surface/hover grays.
const { theme, problems } = makeColors({
  label: 'luxnox',
  id: 'luxnox',
  contrast: 'more',
  light: {
    roles: { accent: '#0b43b1', danger: '#981617', success: '#10591b', warning: '#5c4b0d', pro: '#8a157a' },
    git: { added: '#10591b', removed: '#981617', modified: '#5c4b0d', merged: '#8a157a', closed: '#981617', conflicting: '#a23000', draft: '#565656' },
    gray: {
      anchors: {
        'surface-0': '#ffffff',
        'surface-1': '#ffffff',
        'surface-2': '#ffffff',
        'surface-3': '#ffffff',
        'text-primary': '#111111',
        'text-secondary': '#333333',
        'text-muted': '#565656',
      },
    },
  },
  dark: {
    roles: { accent: '#6699fa', danger: '#fb6e63', success: '#1fb339', warning: '#c8911c', pro: '#ef63e0' },
    git: { added: '#1fb339', removed: '#fb6e63', modified: '#c8911c', merged: '#ef63e0', closed: '#fb6e63', conflicting: '#ff9e8e', draft: '#a3a3a3' },
    gray: {
      anchors: {
        'surface-0': '#000000',
        'surface-1': '#0f0f0f',
        'surface-2': '#1a1a1a',
        'surface-3': '#1a1a1a',
        'text-primary': '#e6e6e6',
        'text-secondary': '#c4c4c4',
        'text-muted': '#a3a3a3',
      },
    },
  },
})

const LOOK: ThemeSetArgs = { colors: theme }

export const register: Register = on => {
  on('session.start', async ($, e, next) => {
    const unpainted = problems.find(line => line.startsWith("Desktop won't paint"))
    if (unpainted !== undefined) {
      $.ui.toast(unpainted)
    }
    const set = await $.theme.set(LOOK)
    if (!set.isDrawn) {
      $.ui.status(set.reason)
    }
    return next(e)
  })
}