test-themes.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Default themes for TUI tests using chalk
  3. */
  4. import { Chalk } from "chalk";
  5. import type { EditorTheme, MarkdownTheme, SelectListTheme } from "../src/index.ts";
  6. const chalk = new Chalk({ level: 3 });
  7. export const defaultSelectListTheme: SelectListTheme = {
  8. selectedPrefix: (text: string) => chalk.blue(text),
  9. selectedText: (text: string) => chalk.bold(text),
  10. description: (text: string) => chalk.dim(text),
  11. scrollInfo: (text: string) => chalk.dim(text),
  12. noMatch: (text: string) => chalk.dim(text),
  13. };
  14. export const defaultMarkdownTheme: MarkdownTheme = {
  15. heading: (text: string) => chalk.bold.cyan(text),
  16. link: (text: string) => chalk.blue(text),
  17. linkUrl: (text: string) => chalk.dim(text),
  18. code: (text: string) => chalk.yellow(text),
  19. codeBlock: (text: string) => chalk.green(text),
  20. codeBlockBorder: (text: string) => chalk.dim(text),
  21. quote: (text: string) => chalk.italic(text),
  22. quoteBorder: (text: string) => chalk.dim(text),
  23. hr: (text: string) => chalk.dim(text),
  24. listBullet: (text: string) => chalk.cyan(text),
  25. bold: (text: string) => chalk.bold(text),
  26. italic: (text: string) => chalk.italic(text),
  27. strikethrough: (text: string) => chalk.strikethrough(text),
  28. underline: (text: string) => chalk.underline(text),
  29. };
  30. export const defaultEditorTheme: EditorTheme = {
  31. borderColor: (text: string) => chalk.dim(text),
  32. selectList: defaultSelectListTheme,
  33. };