theme-tokens.mdx 12 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {/* Generated by packages/www/script/generate-theme-tokens.ts. Do not edit. */}
  2. ```json title="my-theme.json"
  3. {
  4. "version": 2,
  5. "light": {
  6. "hue": {
  7. "accent": "$hue.purple",
  8. "interactive": "$hue.purple"
  9. },
  10. "text": {
  11. "default": "$hue.neutral.900"
  12. },
  13. "background": {
  14. "default": "#fafafa"
  15. }
  16. },
  17. "dark": {
  18. "mergeMode": true,
  19. "text": {
  20. "default": "$hue.neutral.100"
  21. },
  22. "background": {
  23. "default": "#101014"
  24. }
  25. }
  26. }
  27. ```
  28. ## Token reference
  29. This reference is generated from the Effect schema in
  30. `@opencode-ai/theme/tui`. Changes to the runtime schema update
  31. this section through `bun run generate`.
  32. ### Hue tokens
  33. Every hue is a 9-step scale. Define a scale with all of these
  34. steps, or alias it to another hue with a value such as `$hue.blue`.
  35. | | Values |
  36. | ----- | -------------------------------------------------------------------------------------------------------- |
  37. | Hues | `gray`, `red`, `orange`, `yellow`, `green`, `cyan`, `blue`, `purple`, `accent`, `interactive`, `neutral` |
  38. | Steps | `100`, `200`, `300`, `400`, `500`, `600`, `700`, `800`, `900` |
  39. Reference a hue color as `$hue.<name>.<step>`, for example
  40. `$hue.interactive.500`.
  41. ### Semantic tokens
  42. Semantic values can reference another token by prefixing its path with `$`,
  43. for example `$text.default`. Stateful tokens inherit their `default`
  44. value when a state is omitted.
  45. | Group | Tokens |
  46. | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  47. | `text` | `text.default`<br />`text.subdued` |
  48. | `text.action` | `text.action.primary.default`<br />`text.action.primary.$hovered`<br />`text.action.primary.$focused`<br />`text.action.primary.$pressed`<br />`text.action.primary.$selected`<br />`text.action.primary.$disabled`<br />`text.action.destructive.default`<br />`text.action.destructive.$hovered`<br />`text.action.destructive.$focused`<br />`text.action.destructive.$pressed`<br />`text.action.destructive.$selected`<br />`text.action.destructive.$disabled` |
  49. | `text.formfield` | `text.formfield.default`<br />`text.formfield.$hovered`<br />`text.formfield.$focused`<br />`text.formfield.$pressed`<br />`text.formfield.$selected`<br />`text.formfield.$disabled` |
  50. | `text.feedback` | `text.feedback.error.default`<br />`text.feedback.error.subdued`<br />`text.feedback.warning.default`<br />`text.feedback.warning.subdued`<br />`text.feedback.success.default`<br />`text.feedback.success.subdued`<br />`text.feedback.info.default`<br />`text.feedback.info.subdued` |
  51. | `background` | `background.default` |
  52. | `background.surface` | `background.surface.offset`<br />`background.surface.overlay` |
  53. | `background.action` | `background.action.primary.default`<br />`background.action.primary.$hovered`<br />`background.action.primary.$focused`<br />`background.action.primary.$pressed`<br />`background.action.primary.$selected`<br />`background.action.primary.$disabled`<br />`background.action.destructive.default`<br />`background.action.destructive.$hovered`<br />`background.action.destructive.$focused`<br />`background.action.destructive.$pressed`<br />`background.action.destructive.$selected`<br />`background.action.destructive.$disabled` |
  54. | `background.formfield` | `background.formfield.default`<br />`background.formfield.$hovered`<br />`background.formfield.$focused`<br />`background.formfield.$pressed`<br />`background.formfield.$selected`<br />`background.formfield.$disabled` |
  55. | `background.feedback` | `background.feedback.error.default`<br />`background.feedback.warning.default`<br />`background.feedback.success.default`<br />`background.feedback.info.default` |
  56. | `border` | `border.default` |
  57. | `scrollbar` | `scrollbar.default` |
  58. | `diff.text` | `diff.text.added`<br />`diff.text.removed`<br />`diff.text.context`<br />`diff.text.hunkHeader` |
  59. | `diff.background` | `diff.background.added`<br />`diff.background.removed`<br />`diff.background.context` |
  60. | `diff.highlight` | `diff.highlight.added`<br />`diff.highlight.removed` |
  61. | `diff.lineNumber` | `diff.lineNumber.text`<br />`diff.lineNumber.background.added`<br />`diff.lineNumber.background.removed` |
  62. | `syntax` | `syntax.comment`<br />`syntax.keyword`<br />`syntax.function`<br />`syntax.variable`<br />`syntax.string`<br />`syntax.number`<br />`syntax.type`<br />`syntax.operator`<br />`syntax.punctuation` |
  63. | `markdown` | `markdown.text`<br />`markdown.heading`<br />`markdown.link`<br />`markdown.linkText`<br />`markdown.code`<br />`markdown.blockQuote`<br />`markdown.emphasis`<br />`markdown.strong`<br />`markdown.horizontalRule`<br />`markdown.listItem`<br />`markdown.listEnumeration`<br />`markdown.image`<br />`markdown.imageText`<br />`markdown.codeBlock` |
  64. ### Contexts
  65. `@context:elevated` and `@context:overlay` accept partial
  66. overrides of the semantic tokens above. Components apply these contexts to
  67. surfaces that need different contrast without changing the base theme.