summary refs log tree commit diff
path: root/claude/hooks/make-colors.d.ts
blob: 24f01db2dcd85f9b000ba275ea8df6ea253ca977 (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
import type { ThemeColors } from 'claude-code'

type Hex = string

type Mode = {
  gray?: {
    anchors?: { 'surface-0': Hex; 'text-primary': Hex } & Partial<
      Record<'surface-1' | 'surface-2' | 'surface-3' | 'text-secondary' | 'text-muted', Hex>
    >
    stops?: Record<number, Hex>
  }
  roles?: Roles
  git?: Partial<
    Record<'added' | 'removed' | 'modified' | 'merged' | 'closed' | 'conflicting' | 'draft', Hex>
  >
}

type Role = Hex | { seed?: Hex; stops?: Record<number, Hex>; fillShade?: number }

type Roles = Partial<Record<'accent' | 'danger' | 'success' | 'warning' | 'pro', Role>>

/** A whole theme from a few colors, and what fails. Throws on a color it can't use. */
export function makeColors(definition: {
  label: string
  id?: string
  roles?: Roles
  light?: Mode
  dark?: Mode
  codeTheme?: { light?: string; dark?: string }
  contrast?: 'more'
  only?: 'light' | 'dark'
}): { theme: ThemeColors; problems: string[] }

/** What's wrong with a theme from anywhere, as plain lines. */
export function checkColors(colors: unknown): string[]