@opencode-ai/ui 0.0.0-beta-202606251302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +110 -0
- package/src/assets/audio/alert-01.aac +0 -0
- package/src/assets/audio/alert-01.mp3 +0 -0
- package/src/assets/audio/alert-02.aac +0 -0
- package/src/assets/audio/alert-02.mp3 +0 -0
- package/src/assets/audio/alert-03.aac +0 -0
- package/src/assets/audio/alert-03.mp3 +0 -0
- package/src/assets/audio/alert-04.aac +0 -0
- package/src/assets/audio/alert-04.mp3 +0 -0
- package/src/assets/audio/alert-05.aac +0 -0
- package/src/assets/audio/alert-05.mp3 +0 -0
- package/src/assets/audio/alert-06.aac +0 -0
- package/src/assets/audio/alert-06.mp3 +0 -0
- package/src/assets/audio/alert-07.aac +0 -0
- package/src/assets/audio/alert-07.mp3 +0 -0
- package/src/assets/audio/alert-08.aac +0 -0
- package/src/assets/audio/alert-08.mp3 +0 -0
- package/src/assets/audio/alert-09.aac +0 -0
- package/src/assets/audio/alert-09.mp3 +0 -0
- package/src/assets/audio/alert-10.aac +0 -0
- package/src/assets/audio/alert-10.mp3 +0 -0
- package/src/assets/audio/bip-bop-01.aac +0 -0
- package/src/assets/audio/bip-bop-01.mp3 +0 -0
- package/src/assets/audio/bip-bop-02.aac +0 -0
- package/src/assets/audio/bip-bop-02.mp3 +0 -0
- package/src/assets/audio/bip-bop-03.aac +0 -0
- package/src/assets/audio/bip-bop-03.mp3 +0 -0
- package/src/assets/audio/bip-bop-04.aac +0 -0
- package/src/assets/audio/bip-bop-04.mp3 +0 -0
- package/src/assets/audio/bip-bop-05.aac +0 -0
- package/src/assets/audio/bip-bop-05.mp3 +0 -0
- package/src/assets/audio/bip-bop-06.aac +0 -0
- package/src/assets/audio/bip-bop-06.mp3 +0 -0
- package/src/assets/audio/bip-bop-07.aac +0 -0
- package/src/assets/audio/bip-bop-07.mp3 +0 -0
- package/src/assets/audio/bip-bop-08.aac +0 -0
- package/src/assets/audio/bip-bop-08.mp3 +0 -0
- package/src/assets/audio/bip-bop-09.aac +0 -0
- package/src/assets/audio/bip-bop-09.mp3 +0 -0
- package/src/assets/audio/bip-bop-10.aac +0 -0
- package/src/assets/audio/bip-bop-10.mp3 +0 -0
- package/src/assets/audio/nope-01.aac +0 -0
- package/src/assets/audio/nope-01.mp3 +0 -0
- package/src/assets/audio/nope-02.aac +0 -0
- package/src/assets/audio/nope-02.mp3 +0 -0
- package/src/assets/audio/nope-03.aac +0 -0
- package/src/assets/audio/nope-03.mp3 +0 -0
- package/src/assets/audio/nope-04.aac +0 -0
- package/src/assets/audio/nope-04.mp3 +0 -0
- package/src/assets/audio/nope-05.aac +0 -0
- package/src/assets/audio/nope-05.mp3 +0 -0
- package/src/assets/audio/nope-06.aac +0 -0
- package/src/assets/audio/nope-06.mp3 +0 -0
- package/src/assets/audio/nope-07.aac +0 -0
- package/src/assets/audio/nope-07.mp3 +0 -0
- package/src/assets/audio/nope-08.aac +0 -0
- package/src/assets/audio/nope-08.mp3 +0 -0
- package/src/assets/audio/nope-09.aac +0 -0
- package/src/assets/audio/nope-09.mp3 +0 -0
- package/src/assets/audio/nope-10.aac +0 -0
- package/src/assets/audio/nope-10.mp3 +0 -0
- package/src/assets/audio/nope-11.aac +0 -0
- package/src/assets/audio/nope-11.mp3 +0 -0
- package/src/assets/audio/nope-12.aac +0 -0
- package/src/assets/audio/nope-12.mp3 +0 -0
- package/src/assets/audio/staplebops-01.aac +0 -0
- package/src/assets/audio/staplebops-01.mp3 +0 -0
- package/src/assets/audio/staplebops-02.aac +0 -0
- package/src/assets/audio/staplebops-02.mp3 +0 -0
- package/src/assets/audio/staplebops-03.aac +0 -0
- package/src/assets/audio/staplebops-03.mp3 +0 -0
- package/src/assets/audio/staplebops-04.aac +0 -0
- package/src/assets/audio/staplebops-04.mp3 +0 -0
- package/src/assets/audio/staplebops-05.aac +0 -0
- package/src/assets/audio/staplebops-05.mp3 +0 -0
- package/src/assets/audio/staplebops-06.aac +0 -0
- package/src/assets/audio/staplebops-06.mp3 +0 -0
- package/src/assets/audio/staplebops-07.aac +0 -0
- package/src/assets/audio/staplebops-07.mp3 +0 -0
- package/src/assets/audio/yup-01.aac +0 -0
- package/src/assets/audio/yup-01.mp3 +0 -0
- package/src/assets/audio/yup-02.aac +0 -0
- package/src/assets/audio/yup-02.mp3 +0 -0
- package/src/assets/audio/yup-03.aac +0 -0
- package/src/assets/audio/yup-03.mp3 +0 -0
- package/src/assets/audio/yup-04.aac +0 -0
- package/src/assets/audio/yup-04.mp3 +0 -0
- package/src/assets/audio/yup-05.aac +0 -0
- package/src/assets/audio/yup-05.mp3 +0 -0
- package/src/assets/audio/yup-06.aac +0 -0
- package/src/assets/audio/yup-06.mp3 +0 -0
- package/src/assets/fonts/Inter.ttf +0 -0
- package/src/assets/fonts/JetBrainsMonoNerdFontMono-Regular.woff2 +0 -0
- package/src/assets/icons/app/android-studio.svg +369 -0
- package/src/assets/icons/app/antigravity.svg +97 -0
- package/src/assets/icons/app/cursor.svg +16 -0
- package/src/assets/icons/app/file-explorer.svg +20 -0
- package/src/assets/icons/app/finder.png +0 -0
- package/src/assets/icons/app/ghostty.svg +13 -0
- package/src/assets/icons/app/iterm2.svg +13 -0
- package/src/assets/icons/app/powershell.svg +14 -0
- package/src/assets/icons/app/sublimetext.svg +17 -0
- package/src/assets/icons/app/terminal.png +0 -0
- package/src/assets/icons/app/textmate.png +0 -0
- package/src/assets/icons/app/vscode.svg +39 -0
- package/src/assets/icons/app/warp.png +0 -0
- package/src/assets/icons/app/xcode.png +0 -0
- package/src/assets/icons/app/zed-dark.svg +15 -0
- package/src/assets/icons/app/zed.svg +15 -0
- package/src/components/accordion.css +123 -0
- package/src/components/accordion.tsx +92 -0
- package/src/components/animated-number.css +75 -0
- package/src/components/animated-number.tsx +109 -0
- package/src/components/app-icon.css +5 -0
- package/src/components/app-icon.tsx +85 -0
- package/src/components/app-icons/sprite.svg +114 -0
- package/src/components/app-icons/types.ts +21 -0
- package/src/components/avatar.css +49 -0
- package/src/components/avatar.tsx +55 -0
- package/src/components/button.css +194 -0
- package/src/components/button.tsx +33 -0
- package/src/components/card.css +94 -0
- package/src/components/card.tsx +123 -0
- package/src/components/checkbox.css +131 -0
- package/src/components/checkbox.tsx +43 -0
- package/src/components/collapsible.css +148 -0
- package/src/components/collapsible.tsx +48 -0
- package/src/components/context-menu.css +134 -0
- package/src/components/context-menu.tsx +308 -0
- package/src/components/dialog.css +181 -0
- package/src/components/dialog.tsx +72 -0
- package/src/components/diff-changes.css +42 -0
- package/src/components/diff-changes.tsx +115 -0
- package/src/components/dock-surface.css +23 -0
- package/src/components/dock-surface.tsx +54 -0
- package/src/components/dropdown-menu.css +135 -0
- package/src/components/dropdown-menu.tsx +308 -0
- package/src/components/favicon.tsx +13 -0
- package/src/components/file-icon.css +26 -0
- package/src/components/file-icon.tsx +588 -0
- package/src/components/file-icons/sprite.svg +11707 -0
- package/src/components/file-icons/types.ts +1095 -0
- package/src/components/font.tsx +1 -0
- package/src/components/hover-card.css +61 -0
- package/src/components/hover-card.tsx +32 -0
- package/src/components/icon-button.css +181 -0
- package/src/components/icon-button.tsx +29 -0
- package/src/components/icon.css +34 -0
- package/src/components/icon.tsx +169 -0
- package/src/components/image-preview.css +63 -0
- package/src/components/image-preview.tsx +32 -0
- package/src/components/inline-input.css +17 -0
- package/src/components/inline-input.tsx +22 -0
- package/src/components/keybind.css +18 -0
- package/src/components/keybind.tsx +20 -0
- package/src/components/list.css +331 -0
- package/src/components/list.tsx +394 -0
- package/src/components/logo.css +4 -0
- package/src/components/logo.tsx +62 -0
- package/src/components/motion-spring.tsx +58 -0
- package/src/components/popover.css +98 -0
- package/src/components/popover.tsx +153 -0
- package/src/components/progress-circle.css +12 -0
- package/src/components/progress-circle.tsx +57 -0
- package/src/components/progress.css +63 -0
- package/src/components/progress.tsx +39 -0
- package/src/components/provider-icon.css +5 -0
- package/src/components/provider-icon.tsx +25 -0
- package/src/components/provider-icons/sprite.svg +1135 -0
- package/src/components/provider-icons/types.ts +105 -0
- package/src/components/radio-group.css +187 -0
- package/src/components/radio-group.tsx +83 -0
- package/src/components/resize-handle.css +58 -0
- package/src/components/resize-handle.tsx +82 -0
- package/src/components/scroll-view.css +66 -0
- package/src/components/scroll-view.tsx +250 -0
- package/src/components/select.css +202 -0
- package/src/components/select.tsx +174 -0
- package/src/components/spinner.css +6 -0
- package/src/components/spinner.tsx +52 -0
- package/src/components/sticky-accordion-header.css +6 -0
- package/src/components/sticky-accordion-header.tsx +18 -0
- package/src/components/switch.css +132 -0
- package/src/components/switch.tsx +29 -0
- package/src/components/tabs.css +635 -0
- package/src/components/tabs.tsx +125 -0
- package/src/components/tag.css +37 -0
- package/src/components/tag.tsx +22 -0
- package/src/components/text-field.css +134 -0
- package/src/components/text-field.tsx +128 -0
- package/src/components/text-reveal.css +150 -0
- package/src/components/text-reveal.tsx +143 -0
- package/src/components/text-shimmer.css +119 -0
- package/src/components/text-shimmer.tsx +62 -0
- package/src/components/text-strikethrough.css +27 -0
- package/src/components/text-strikethrough.tsx +84 -0
- package/src/components/toast.css +236 -0
- package/src/components/toast.tsx +185 -0
- package/src/components/tooltip.css +74 -0
- package/src/components/tooltip.tsx +161 -0
- package/src/components/typewriter.css +14 -0
- package/src/components/typewriter.tsx +55 -0
- package/src/context/dialog.tsx +197 -0
- package/src/context/file.tsx +10 -0
- package/src/context/helper.tsx +38 -0
- package/src/context/i18n.tsx +38 -0
- package/src/context/index.ts +4 -0
- package/src/context/marked.tsx +522 -0
- package/src/context/worker-pool.tsx +20 -0
- package/src/custom-elements.d.ts +17 -0
- package/src/hooks/create-auto-scroll.tsx +237 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-filtered-list.tsx +134 -0
- package/src/i18n/ar.ts +168 -0
- package/src/i18n/br.ts +168 -0
- package/src/i18n/bs.ts +172 -0
- package/src/i18n/da.ts +167 -0
- package/src/i18n/de.ts +173 -0
- package/src/i18n/en.ts +176 -0
- package/src/i18n/es.ts +168 -0
- package/src/i18n/fr.ts +168 -0
- package/src/i18n/ja.ts +167 -0
- package/src/i18n/ko.ts +168 -0
- package/src/i18n/no.ts +171 -0
- package/src/i18n/pl.ts +167 -0
- package/src/i18n/ru.ts +167 -0
- package/src/i18n/th.ts +169 -0
- package/src/i18n/tr.ts +174 -0
- package/src/i18n/uk.ts +167 -0
- package/src/i18n/zh.ts +171 -0
- package/src/i18n/zht.ts +171 -0
- package/src/storybook/fixtures.ts +51 -0
- package/src/storybook/scaffold.tsx +62 -0
- package/src/styles/animations.css +141 -0
- package/src/styles/base.css +404 -0
- package/src/styles/colors.css +772 -0
- package/src/styles/index.css +53 -0
- package/src/styles/tailwind/colors.css +285 -0
- package/src/styles/tailwind/index.css +78 -0
- package/src/styles/tailwind/utilities.css +131 -0
- package/src/styles/theme.css +609 -0
- package/src/styles/utilities.css +118 -0
- package/src/theme/color.ts +299 -0
- package/src/theme/context.tsx +370 -0
- package/src/theme/default-themes.ts +116 -0
- package/src/theme/index.ts +78 -0
- package/src/theme/loader.ts +112 -0
- package/src/theme/resolve.ts +540 -0
- package/src/theme/themes/amoled.json +49 -0
- package/src/theme/themes/aura.json +51 -0
- package/src/theme/themes/ayu.json +51 -0
- package/src/theme/themes/carbonfox.json +53 -0
- package/src/theme/themes/catppuccin-frappe.json +85 -0
- package/src/theme/themes/catppuccin-macchiato.json +85 -0
- package/src/theme/themes/catppuccin.json +45 -0
- package/src/theme/themes/cobalt2.json +87 -0
- package/src/theme/themes/cursor.json +91 -0
- package/src/theme/themes/dracula.json +49 -0
- package/src/theme/themes/everforest.json +89 -0
- package/src/theme/themes/flexoki.json +86 -0
- package/src/theme/themes/github.json +85 -0
- package/src/theme/themes/gruvbox.json +45 -0
- package/src/theme/themes/kanagawa.json +89 -0
- package/src/theme/themes/lucent-orng.json +87 -0
- package/src/theme/themes/material.json +87 -0
- package/src/theme/themes/matrix.json +113 -0
- package/src/theme/themes/mercury.json +86 -0
- package/src/theme/themes/monokai.json +49 -0
- package/src/theme/themes/nightowl.json +46 -0
- package/src/theme/themes/nord.json +46 -0
- package/src/theme/themes/oc-2.json +468 -0
- package/src/theme/themes/one-dark.json +89 -0
- package/src/theme/themes/onedarkpro.json +45 -0
- package/src/theme/themes/opencode.json +89 -0
- package/src/theme/themes/orng.json +87 -0
- package/src/theme/themes/osaka-jade.json +88 -0
- package/src/theme/themes/palenight.json +85 -0
- package/src/theme/themes/rosepine.json +85 -0
- package/src/theme/themes/shadesofpurple.json +51 -0
- package/src/theme/themes/solarized.json +49 -0
- package/src/theme/themes/synthwave84.json +87 -0
- package/src/theme/themes/tokyonight.json +47 -0
- package/src/theme/themes/vercel.json +90 -0
- package/src/theme/themes/vesper.json +51 -0
- package/src/theme/themes/zenburn.json +87 -0
- package/src/theme/types.ts +75 -0
- package/src/theme/v2/avatar.ts +48 -0
- package/src/theme/v2/default-primitives.ts +114 -0
- package/src/theme/v2/foreground.ts +60 -0
- package/src/theme/v2/mapping.ts +138 -0
- package/src/theme/v2/resolve.ts +153 -0
- package/src/v2/components/accordion-v2.css +139 -0
- package/src/v2/components/accordion-v2.tsx +86 -0
- package/src/v2/components/avatar-v2.css +70 -0
- package/src/v2/components/avatar-v2.tsx +59 -0
- package/src/v2/components/badge-v2.css +27 -0
- package/src/v2/components/badge-v2.tsx +20 -0
- package/src/v2/components/button-v2.css +186 -0
- package/src/v2/components/button-v2.tsx +35 -0
- package/src/v2/components/checkbox-v2.css +184 -0
- package/src/v2/components/checkbox-v2.tsx +65 -0
- package/src/v2/components/dialog-v2.css +150 -0
- package/src/v2/components/dialog-v2.tsx +93 -0
- package/src/v2/components/diff-changes-v2.css +24 -0
- package/src/v2/components/diff-changes-v2.tsx +28 -0
- package/src/v2/components/field-v2.css +94 -0
- package/src/v2/components/field-v2.tsx +265 -0
- package/src/v2/components/icon-button-v2.css +155 -0
- package/src/v2/components/icon-button-v2.tsx +37 -0
- package/src/v2/components/icon.tsx +129 -0
- package/src/v2/components/inline-input-v2.css +218 -0
- package/src/v2/components/inline-input-v2.tsx +90 -0
- package/src/v2/components/keybind-v2.css +76 -0
- package/src/v2/components/keybind-v2.tsx +30 -0
- package/src/v2/components/line-comment-v2.css +204 -0
- package/src/v2/components/line-comment-v2.tsx +155 -0
- package/src/v2/components/menu-v2.css +190 -0
- package/src/v2/components/menu-v2.tsx +225 -0
- package/src/v2/components/project-avatar-v2.css +126 -0
- package/src/v2/components/project-avatar-v2.tsx +64 -0
- package/src/v2/components/radio-v2.css +202 -0
- package/src/v2/components/radio-v2.tsx +72 -0
- package/src/v2/components/segmented-control-v2.css +80 -0
- package/src/v2/components/segmented-control-v2.tsx +208 -0
- package/src/v2/components/select-v2.css +285 -0
- package/src/v2/components/select-v2.tsx +208 -0
- package/src/v2/components/switch-v2.css +154 -0
- package/src/v2/components/switch-v2.tsx +28 -0
- package/src/v2/components/tab-state-indicator.tsx +37 -0
- package/src/v2/components/tabs-v2.css +225 -0
- package/src/v2/components/tabs-v2.tsx +147 -0
- package/src/v2/components/text-input-v2.css +145 -0
- package/src/v2/components/text-input-v2.tsx +67 -0
- package/src/v2/components/text-shimmer-v2.css +125 -0
- package/src/v2/components/text-shimmer-v2.tsx +63 -0
- package/src/v2/components/textarea-v2.css +78 -0
- package/src/v2/components/textarea-v2.tsx +31 -0
- package/src/v2/components/toast-v2.css +215 -0
- package/src/v2/components/toast-v2.tsx +144 -0
- package/src/v2/components/tooltip-v2.css +53 -0
- package/src/v2/components/tooltip-v2.tsx +146 -0
- package/src/v2/components/wordmark-v2.tsx +92 -0
- package/src/v2/styles/colors.css +172 -0
- package/src/v2/styles/tailwind.css +2 -0
- package/src/v2/styles/theme.css +441 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import type { ColorValue, DesktopTheme, HexColor, ResolvedTheme, ThemeVariant } from "./types"
|
|
2
|
+
import { blend, generateNeutralScale, generateScale, hexToOklch, hexToRgb, shift, withAlpha } from "./color"
|
|
3
|
+
|
|
4
|
+
export function resolveThemeVariant(variant: ThemeVariant, isDark: boolean): ResolvedTheme {
|
|
5
|
+
const colors = getColors(variant)
|
|
6
|
+
const { overrides = {} } = variant
|
|
7
|
+
|
|
8
|
+
const neutral = generateNeutralScale(colors.neutral, isDark, colors.ink)
|
|
9
|
+
const primary = generateScale(colors.primary, isDark)
|
|
10
|
+
const accent = generateScale(colors.accent, isDark)
|
|
11
|
+
const success = generateScale(colors.success, isDark)
|
|
12
|
+
const warning = generateScale(colors.warning, isDark)
|
|
13
|
+
const error = generateScale(colors.error, isDark)
|
|
14
|
+
const info = generateScale(colors.info, isDark)
|
|
15
|
+
const interactive = generateScale(colors.interactive, isDark)
|
|
16
|
+
const amber = generateScale(
|
|
17
|
+
shift(colors.warning, isDark ? { h: -16, l: -0.058, c: 1.14 } : { h: -22, l: -0.082, c: 0.94 }),
|
|
18
|
+
isDark,
|
|
19
|
+
)
|
|
20
|
+
const blue = generateScale(shift(colors.interactive, { h: -12, l: 0.128, c: 1.12 }), isDark)
|
|
21
|
+
const diffAdd = generateScale(
|
|
22
|
+
colors.diffAdd ?? shift(colors.success, { c: isDark ? 0.7 : 0.55, l: isDark ? -0.18 : 0.14 }),
|
|
23
|
+
isDark,
|
|
24
|
+
)
|
|
25
|
+
const diffDelete = generateScale(
|
|
26
|
+
colors.diffDelete ?? shift(colors.error, { c: isDark ? 0.82 : 0.7, l: isDark ? -0.08 : 0.08 }),
|
|
27
|
+
isDark,
|
|
28
|
+
)
|
|
29
|
+
const ink = colors.ink ?? colors.neutral
|
|
30
|
+
const tint = colors.compact ? hexToOklch(ink) : undefined
|
|
31
|
+
const body = tint
|
|
32
|
+
? shift(ink, {
|
|
33
|
+
l: isDark ? Math.max(0, 0.88 - tint.l) * 0.4 : -Math.max(0, tint.l - 0.18) * 0.24,
|
|
34
|
+
c: isDark ? 1.04 : 1.02,
|
|
35
|
+
})
|
|
36
|
+
: undefined
|
|
37
|
+
const backgroundOverride = overrides["background-base"]
|
|
38
|
+
const backgroundHex = getHex(backgroundOverride)
|
|
39
|
+
const overlay = Boolean(backgroundOverride) && !backgroundHex
|
|
40
|
+
const content = (seed: HexColor, scale: HexColor[]) => {
|
|
41
|
+
const base = hexToOklch(seed)
|
|
42
|
+
const value = isDark ? (base.l > 0.84 ? shift(seed, { c: 1.18 }) : scale[10]) : scale[10]
|
|
43
|
+
return shift(value, { l: isDark ? 0.034 : -0.024, c: isDark ? 1.3 : 1.18 })
|
|
44
|
+
}
|
|
45
|
+
const modified = () => {
|
|
46
|
+
if (!colors.compact) return isDark ? "#ffba92" : "#FF8C00"
|
|
47
|
+
const warningHue = hexToOklch(colors.warning).h
|
|
48
|
+
const deleteHue = hexToOklch(colors.diffDelete ?? colors.error).h
|
|
49
|
+
const delta = Math.abs(((((deleteHue - warningHue) % 360) + 540) % 360) - 180)
|
|
50
|
+
if (delta < 48) return isDark ? "#ffba92" : "#FF8C00"
|
|
51
|
+
return content(colors.warning, warning)
|
|
52
|
+
}
|
|
53
|
+
const surface = (
|
|
54
|
+
seed: HexColor,
|
|
55
|
+
alpha: { base: number; weak: number; weaker: number; strong: number; stronger: number },
|
|
56
|
+
) => {
|
|
57
|
+
const base = alphaTone(seed, alpha.base)
|
|
58
|
+
return {
|
|
59
|
+
base,
|
|
60
|
+
weak: alphaTone(seed, alpha.weak),
|
|
61
|
+
weaker: alphaTone(seed, alpha.weaker),
|
|
62
|
+
strong: alphaTone(seed, alpha.strong),
|
|
63
|
+
stronger: alphaTone(seed, alpha.stronger),
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const background = backgroundHex ?? neutral[0]
|
|
67
|
+
const alphaTone = (color: HexColor, alpha: number) =>
|
|
68
|
+
overlay ? (withAlpha(color, alpha) as ColorValue) : blend(color, background, alpha)
|
|
69
|
+
const borderTone = (light: number, dark: number) =>
|
|
70
|
+
alphaTone(ink, isDark ? Math.min(1, dark + 0.024 + (colors.compact ? 0.08 : 0)) : Math.min(1, light + 0.024))
|
|
71
|
+
const diffHiddenSurface = surface(
|
|
72
|
+
isDark ? shift(colors.interactive, { c: 0.55, l: 0 }) : shift(colors.interactive, { c: 0.45, l: 0.08 }),
|
|
73
|
+
isDark
|
|
74
|
+
? { base: 0.14, weak: 0.08, weaker: 0.18, strong: 0.26, stronger: 0.42 }
|
|
75
|
+
: { base: 0.12, weak: 0.08, weaker: 0.16, strong: 0.24, stronger: 0.36 },
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
const neutralAlpha = generateNeutralAlphaScale(neutral, isDark)
|
|
79
|
+
const brandb = primary[8]
|
|
80
|
+
const brandh = primary[9]
|
|
81
|
+
const interb = interactive[isDark ? 6 : 4]
|
|
82
|
+
const interh = interactive[isDark ? 7 : 5]
|
|
83
|
+
const interw = interactive[isDark ? 5 : 3]
|
|
84
|
+
const succb = success[isDark ? 6 : 4]
|
|
85
|
+
const succw = success[isDark ? 5 : 3]
|
|
86
|
+
const succs = success[10]
|
|
87
|
+
const warnb = warning[isDark ? 6 : 4]
|
|
88
|
+
const warnw = warning[isDark ? 5 : 3]
|
|
89
|
+
const warns = warning[10]
|
|
90
|
+
const critb = error[isDark ? 6 : 4]
|
|
91
|
+
const critw = error[isDark ? 5 : 3]
|
|
92
|
+
const crits = error[10]
|
|
93
|
+
const infob = info[isDark ? 6 : 4]
|
|
94
|
+
const infow = info[isDark ? 5 : 3]
|
|
95
|
+
const infos = info[10]
|
|
96
|
+
const lum = (hex: HexColor) => {
|
|
97
|
+
const rgb = hexToRgb(hex)
|
|
98
|
+
const lift = (v: number) => (v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4))
|
|
99
|
+
return 0.2126 * lift(rgb.r) + 0.7152 * lift(rgb.g) + 0.0722 * lift(rgb.b)
|
|
100
|
+
}
|
|
101
|
+
const hit = (a: HexColor, b: HexColor) => {
|
|
102
|
+
const x = lum(a)
|
|
103
|
+
const y = lum(b)
|
|
104
|
+
const light = Math.max(x, y)
|
|
105
|
+
const dark = Math.min(x, y)
|
|
106
|
+
return (light + 0.05) / (dark + 0.05)
|
|
107
|
+
}
|
|
108
|
+
const on = (fill: HexColor) => {
|
|
109
|
+
const light = "#ffffff" as HexColor
|
|
110
|
+
const dark = "#000000" as HexColor
|
|
111
|
+
return hit(light, fill) > hit(dark, fill) ? light : dark
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const tokens: ResolvedTheme = {}
|
|
115
|
+
|
|
116
|
+
tokens["background-base"] = neutral[0]
|
|
117
|
+
tokens["background-weak"] = neutral[2]
|
|
118
|
+
tokens["background-strong"] = neutral[0]
|
|
119
|
+
tokens["background-stronger"] = isDark ? neutral[1] : "#fcfcfc"
|
|
120
|
+
|
|
121
|
+
tokens["surface-base"] = neutralAlpha[1]
|
|
122
|
+
tokens["base"] = neutralAlpha[1]
|
|
123
|
+
tokens["surface-base-hover"] = neutralAlpha[2]
|
|
124
|
+
tokens["surface-base-active"] = neutralAlpha[2]
|
|
125
|
+
tokens["surface-base-interactive-active"] = withAlpha(interactive[2], 0.3) as ColorValue
|
|
126
|
+
tokens["base2"] = neutralAlpha[1]
|
|
127
|
+
tokens["base3"] = neutralAlpha[1]
|
|
128
|
+
tokens["surface-inset-base"] = neutralAlpha[1]
|
|
129
|
+
tokens["surface-inset-base-hover"] = neutralAlpha[2]
|
|
130
|
+
tokens["surface-inset-strong"] = isDark
|
|
131
|
+
? (withAlpha(neutral[0], 0.5) as ColorValue)
|
|
132
|
+
: (withAlpha(neutral[3], 0.09) as ColorValue)
|
|
133
|
+
tokens["surface-inset-strong-hover"] = tokens["surface-inset-strong"]
|
|
134
|
+
tokens["surface-raised-base"] = neutralAlpha[0]
|
|
135
|
+
tokens["surface-float-base"] = isDark ? neutral[1] : neutral[11]
|
|
136
|
+
tokens["surface-float-base-hover"] = isDark ? neutral[2] : neutral[10]
|
|
137
|
+
tokens["surface-raised-base-hover"] = neutralAlpha[1]
|
|
138
|
+
tokens["surface-raised-base-active"] = neutralAlpha[2]
|
|
139
|
+
tokens["surface-raised-strong"] = isDark ? neutralAlpha[3] : neutral[0]
|
|
140
|
+
tokens["surface-raised-strong-hover"] = isDark ? neutralAlpha[5] : "#ffffff"
|
|
141
|
+
tokens["surface-raised-stronger"] = isDark ? neutralAlpha[5] : "#ffffff"
|
|
142
|
+
tokens["surface-raised-stronger-hover"] = isDark ? neutralAlpha[6] : "#ffffff"
|
|
143
|
+
tokens["surface-weak"] = neutralAlpha[2]
|
|
144
|
+
tokens["surface-weaker"] = neutralAlpha[3]
|
|
145
|
+
tokens["surface-strong"] = isDark ? neutralAlpha[6] : "#ffffff"
|
|
146
|
+
tokens["surface-raised-stronger-non-alpha"] = isDark ? neutral[2] : "#ffffff"
|
|
147
|
+
|
|
148
|
+
tokens["surface-brand-base"] = brandb
|
|
149
|
+
tokens["surface-brand-hover"] = brandh
|
|
150
|
+
|
|
151
|
+
tokens["surface-interactive-base"] = interb
|
|
152
|
+
tokens["surface-interactive-hover"] = interh
|
|
153
|
+
tokens["surface-interactive-weak"] = interw
|
|
154
|
+
tokens["surface-interactive-weak-hover"] = interb
|
|
155
|
+
|
|
156
|
+
tokens["surface-success-base"] = succb
|
|
157
|
+
tokens["surface-success-weak"] = succw
|
|
158
|
+
tokens["surface-success-strong"] = succs
|
|
159
|
+
tokens["surface-warning-base"] = warnb
|
|
160
|
+
tokens["surface-warning-weak"] = warnw
|
|
161
|
+
tokens["surface-warning-strong"] = warns
|
|
162
|
+
tokens["surface-critical-base"] = critb
|
|
163
|
+
tokens["surface-critical-weak"] = critw
|
|
164
|
+
tokens["surface-critical-strong"] = crits
|
|
165
|
+
tokens["surface-info-base"] = infob
|
|
166
|
+
tokens["surface-info-weak"] = infow
|
|
167
|
+
tokens["surface-info-strong"] = infos
|
|
168
|
+
|
|
169
|
+
tokens["surface-diff-unchanged-base"] = isDark ? neutral[0] : "#ffffff00"
|
|
170
|
+
tokens["surface-diff-skip-base"] = isDark ? neutralAlpha[0] : neutral[1]
|
|
171
|
+
tokens["surface-diff-hidden-base"] = diffHiddenSurface.base
|
|
172
|
+
tokens["surface-diff-hidden-weak"] = diffHiddenSurface.weak
|
|
173
|
+
tokens["surface-diff-hidden-weaker"] = diffHiddenSurface.weaker
|
|
174
|
+
tokens["surface-diff-hidden-strong"] = diffHiddenSurface.strong
|
|
175
|
+
tokens["surface-diff-hidden-stronger"] = diffHiddenSurface.stronger
|
|
176
|
+
tokens["surface-diff-add-base"] = diffAdd[2]
|
|
177
|
+
tokens["surface-diff-add-weak"] = diffAdd[isDark ? 3 : 1]
|
|
178
|
+
tokens["surface-diff-add-weaker"] = diffAdd[isDark ? 2 : 0]
|
|
179
|
+
tokens["surface-diff-add-strong"] = diffAdd[4]
|
|
180
|
+
tokens["surface-diff-add-stronger"] = diffAdd[isDark ? 10 : 8]
|
|
181
|
+
tokens["surface-diff-delete-base"] = diffDelete[2]
|
|
182
|
+
tokens["surface-diff-delete-weak"] = diffDelete[isDark ? 3 : 1]
|
|
183
|
+
tokens["surface-diff-delete-weaker"] = diffDelete[isDark ? 2 : 0]
|
|
184
|
+
tokens["surface-diff-delete-strong"] = diffDelete[isDark ? 4 : 5]
|
|
185
|
+
tokens["surface-diff-delete-stronger"] = diffDelete[isDark ? 10 : 8]
|
|
186
|
+
|
|
187
|
+
tokens["input-base"] = isDark ? neutral[1] : neutral[0]
|
|
188
|
+
tokens["input-hover"] = isDark ? neutral[2] : neutral[1]
|
|
189
|
+
tokens["input-active"] = isDark ? interactive[6] : interactive[0]
|
|
190
|
+
tokens["input-selected"] = isDark ? interactive[7] : interactive[3]
|
|
191
|
+
tokens["input-focus"] = isDark ? interactive[6] : interactive[0]
|
|
192
|
+
tokens["input-disabled"] = neutral[3]
|
|
193
|
+
|
|
194
|
+
tokens["text-base"] = colors.compact ? (body as HexColor) : neutral[10]
|
|
195
|
+
tokens["text-weak"] = colors.compact ? shift(body as HexColor, { l: isDark ? -0.11 : 0.11, c: 0.9 }) : neutral[8]
|
|
196
|
+
tokens["text-weaker"] = colors.compact
|
|
197
|
+
? shift(body as HexColor, { l: isDark ? -0.2 : 0.21, c: isDark ? 0.78 : 0.72 })
|
|
198
|
+
: neutral[7]
|
|
199
|
+
tokens["text-strong"] = colors.compact
|
|
200
|
+
? isDark
|
|
201
|
+
? blend("#ffffff", body as HexColor, 0.9)
|
|
202
|
+
: shift(body as HexColor, { l: -0.07, c: 1.04 })
|
|
203
|
+
: neutral[11]
|
|
204
|
+
tokens["text-invert-base"] = isDark ? neutral[10] : neutral[1]
|
|
205
|
+
tokens["text-invert-weak"] = isDark ? neutral[8] : neutral[2]
|
|
206
|
+
tokens["text-invert-weaker"] = isDark ? neutral[7] : neutral[3]
|
|
207
|
+
tokens["text-invert-strong"] = isDark ? neutral[11] : neutral[0]
|
|
208
|
+
tokens["text-interactive-base"] = interactive[isDark ? 10 : 9]
|
|
209
|
+
tokens["text-on-brand-base"] = on(brandb)
|
|
210
|
+
tokens["text-on-interactive-base"] = on(interb)
|
|
211
|
+
tokens["text-on-interactive-weak"] = on(interb)
|
|
212
|
+
tokens["text-on-success-base"] = on(succb)
|
|
213
|
+
tokens["text-on-critical-base"] = on(critb)
|
|
214
|
+
tokens["text-on-critical-weak"] = on(critb)
|
|
215
|
+
tokens["text-on-critical-strong"] = on(crits)
|
|
216
|
+
tokens["text-on-warning-base"] = on(warnb)
|
|
217
|
+
tokens["text-on-info-base"] = on(infob)
|
|
218
|
+
tokens["text-diff-add-base"] = diffAdd[10]
|
|
219
|
+
tokens["text-diff-delete-base"] = diffDelete[9]
|
|
220
|
+
tokens["text-diff-delete-strong"] = diffDelete[11]
|
|
221
|
+
tokens["text-diff-add-strong"] = diffAdd[isDark ? 7 : 11]
|
|
222
|
+
tokens["text-on-info-weak"] = on(infob)
|
|
223
|
+
tokens["text-on-info-strong"] = on(infos)
|
|
224
|
+
tokens["text-on-warning-weak"] = on(warnb)
|
|
225
|
+
tokens["text-on-warning-strong"] = on(warns)
|
|
226
|
+
tokens["text-on-success-weak"] = on(succb)
|
|
227
|
+
tokens["text-on-success-strong"] = on(succs)
|
|
228
|
+
tokens["text-on-brand-weak"] = on(brandb)
|
|
229
|
+
tokens["text-on-brand-weaker"] = on(brandb)
|
|
230
|
+
tokens["text-on-brand-strong"] = on(brandh)
|
|
231
|
+
|
|
232
|
+
tokens["button-primary-base"] = neutral[11]
|
|
233
|
+
tokens["button-secondary-base"] = isDark ? neutral[2] : neutral[0]
|
|
234
|
+
tokens["button-secondary-hover"] = isDark ? neutral[3] : neutral[1]
|
|
235
|
+
tokens["button-ghost-hover"] = neutralAlpha[1]
|
|
236
|
+
tokens["button-ghost-hover2"] = neutralAlpha[2]
|
|
237
|
+
|
|
238
|
+
tokens["border-base"] = colors.compact ? borderTone(0.22, 0.16) : neutralAlpha[6]
|
|
239
|
+
tokens["border-hover"] = colors.compact ? borderTone(0.28, 0.2) : neutralAlpha[7]
|
|
240
|
+
tokens["border-active"] = colors.compact ? borderTone(0.34, 0.24) : neutralAlpha[8]
|
|
241
|
+
tokens["border-selected"] = withAlpha(interactive[8], isDark ? 0.9 : 0.99) as ColorValue
|
|
242
|
+
tokens["border-disabled"] = colors.compact ? borderTone(0.18, 0.12) : neutralAlpha[7]
|
|
243
|
+
tokens["border-focus"] = colors.compact ? borderTone(0.34, 0.24) : neutralAlpha[8]
|
|
244
|
+
tokens["border-weak-base"] = colors.compact ? borderTone(0.1, 0.08) : neutralAlpha[isDark ? 5 : 4]
|
|
245
|
+
tokens["border-strong-base"] = colors.compact ? borderTone(0.34, 0.24) : neutralAlpha[isDark ? 7 : 6]
|
|
246
|
+
tokens["border-strong-hover"] = colors.compact ? borderTone(0.4, 0.28) : neutralAlpha[7]
|
|
247
|
+
tokens["border-strong-active"] = colors.compact ? borderTone(0.46, 0.32) : neutralAlpha[isDark ? 7 : 6]
|
|
248
|
+
tokens["border-strong-selected"] = withAlpha(interactive[5], 0.6) as ColorValue
|
|
249
|
+
tokens["border-strong-disabled"] = colors.compact ? borderTone(0.14, 0.1) : neutralAlpha[5]
|
|
250
|
+
tokens["border-strong-focus"] = colors.compact ? borderTone(0.46, 0.32) : neutralAlpha[isDark ? 7 : 6]
|
|
251
|
+
tokens["border-weak-hover"] = colors.compact ? borderTone(0.16, 0.12) : neutralAlpha[isDark ? 6 : 5]
|
|
252
|
+
tokens["border-weak-active"] = colors.compact ? borderTone(0.22, 0.16) : neutralAlpha[isDark ? 7 : 6]
|
|
253
|
+
tokens["border-weak-selected"] = withAlpha(interactive[4], isDark ? 0.6 : 0.5) as ColorValue
|
|
254
|
+
tokens["border-weak-disabled"] = colors.compact ? borderTone(0.08, 0.06) : neutralAlpha[5]
|
|
255
|
+
tokens["border-weak-focus"] = colors.compact ? borderTone(0.22, 0.16) : neutralAlpha[isDark ? 7 : 6]
|
|
256
|
+
tokens["border-weaker-base"] = colors.compact ? borderTone(0.06, 0.04) : neutralAlpha[2]
|
|
257
|
+
|
|
258
|
+
tokens["border-interactive-base"] = interactive[6]
|
|
259
|
+
tokens["border-interactive-hover"] = interactive[7]
|
|
260
|
+
tokens["border-interactive-active"] = interactive[8]
|
|
261
|
+
tokens["border-interactive-selected"] = interactive[8]
|
|
262
|
+
tokens["border-interactive-disabled"] = neutral[7]
|
|
263
|
+
tokens["border-interactive-focus"] = interactive[8]
|
|
264
|
+
|
|
265
|
+
tokens["border-success-base"] = success[isDark ? 6 : 6]
|
|
266
|
+
tokens["border-success-hover"] = success[isDark ? 7 : 7]
|
|
267
|
+
tokens["border-success-selected"] = success[8]
|
|
268
|
+
tokens["border-warning-base"] = warning[isDark ? 6 : 6]
|
|
269
|
+
tokens["border-warning-hover"] = warning[isDark ? 7 : 7]
|
|
270
|
+
tokens["border-warning-selected"] = warning[8]
|
|
271
|
+
tokens["border-critical-base"] = error[isDark ? 6 : 6]
|
|
272
|
+
tokens["border-critical-hover"] = error[isDark ? 7 : 7]
|
|
273
|
+
tokens["border-critical-selected"] = error[8]
|
|
274
|
+
tokens["border-info-base"] = info[isDark ? 6 : 6]
|
|
275
|
+
tokens["border-info-hover"] = info[isDark ? 7 : 7]
|
|
276
|
+
tokens["border-info-selected"] = info[8]
|
|
277
|
+
tokens["border-color"] = "#ffffff"
|
|
278
|
+
|
|
279
|
+
tokens["icon-base"] = colors.compact && !isDark ? tokens["text-weak"] : neutral[isDark ? 9 : 8]
|
|
280
|
+
tokens["icon-hover"] = colors.compact && !isDark ? tokens["text-base"] : neutral[10]
|
|
281
|
+
tokens["icon-active"] = colors.compact && !isDark ? tokens["text-strong"] : neutral[11]
|
|
282
|
+
tokens["icon-selected"] = colors.compact && !isDark ? tokens["text-strong"] : neutral[11]
|
|
283
|
+
tokens["icon-disabled"] = neutral[isDark ? 6 : 7]
|
|
284
|
+
tokens["icon-focus"] = colors.compact && !isDark ? tokens["text-strong"] : neutral[11]
|
|
285
|
+
tokens["icon-invert-base"] = isDark ? neutral[0] : "#ffffff"
|
|
286
|
+
tokens["icon-weak-base"] = neutral[isDark ? 5 : 6]
|
|
287
|
+
tokens["icon-weak-hover"] = neutral[isDark ? 11 : 7]
|
|
288
|
+
tokens["icon-weak-active"] = neutral[8]
|
|
289
|
+
tokens["icon-weak-selected"] = neutral[isDark ? 8 : 9]
|
|
290
|
+
tokens["icon-weak-disabled"] = neutral[isDark ? 3 : 5]
|
|
291
|
+
tokens["icon-weak-focus"] = neutral[8]
|
|
292
|
+
tokens["icon-strong-base"] = neutral[11]
|
|
293
|
+
tokens["icon-strong-hover"] = isDark ? "#f6f3f3" : "#151313"
|
|
294
|
+
tokens["icon-strong-active"] = isDark ? "#fcfcfc" : "#020202"
|
|
295
|
+
tokens["icon-strong-selected"] = isDark ? "#fdfcfc" : "#020202"
|
|
296
|
+
tokens["icon-strong-disabled"] = neutral[7]
|
|
297
|
+
tokens["icon-strong-focus"] = isDark ? "#fdfcfc" : "#020202"
|
|
298
|
+
tokens["icon-brand-base"] = isDark ? "#ffffff" : neutral[11]
|
|
299
|
+
tokens["icon-interactive-base"] = interactive[8]
|
|
300
|
+
tokens["icon-success-base"] = success[isDark ? 8 : 6]
|
|
301
|
+
tokens["icon-success-hover"] = success[9]
|
|
302
|
+
tokens["icon-success-active"] = success[10]
|
|
303
|
+
tokens["icon-warning-base"] = amber[isDark ? 8 : 6]
|
|
304
|
+
tokens["icon-warning-hover"] = amber[9]
|
|
305
|
+
tokens["icon-warning-active"] = amber[10]
|
|
306
|
+
tokens["icon-critical-base"] = error[isDark ? 8 : 9]
|
|
307
|
+
tokens["icon-critical-hover"] = error[9]
|
|
308
|
+
tokens["icon-critical-active"] = error[10]
|
|
309
|
+
tokens["icon-info-base"] = info[isDark ? 8 : 6]
|
|
310
|
+
tokens["icon-info-hover"] = info[isDark ? 9 : 7]
|
|
311
|
+
tokens["icon-info-active"] = info[10]
|
|
312
|
+
tokens["icon-on-brand-base"] = on(brandb)
|
|
313
|
+
tokens["icon-on-brand-hover"] = on(brandh)
|
|
314
|
+
tokens["icon-on-brand-selected"] = on(brandh)
|
|
315
|
+
tokens["icon-on-interactive-base"] = on(interb)
|
|
316
|
+
|
|
317
|
+
tokens["icon-agent-plan-base"] = info[8]
|
|
318
|
+
tokens["icon-agent-docs-base"] = amber[8]
|
|
319
|
+
tokens["icon-agent-ask-base"] = blue[8]
|
|
320
|
+
tokens["icon-agent-build-base"] = interactive[isDark ? 10 : 8]
|
|
321
|
+
|
|
322
|
+
tokens["icon-on-success-base"] = on(succb)
|
|
323
|
+
tokens["icon-on-success-hover"] = on(succs)
|
|
324
|
+
tokens["icon-on-success-selected"] = on(succs)
|
|
325
|
+
tokens["icon-on-warning-base"] = on(warnb)
|
|
326
|
+
tokens["icon-on-warning-hover"] = on(warns)
|
|
327
|
+
tokens["icon-on-warning-selected"] = on(warns)
|
|
328
|
+
tokens["icon-on-critical-base"] = on(critb)
|
|
329
|
+
tokens["icon-on-critical-hover"] = on(crits)
|
|
330
|
+
tokens["icon-on-critical-selected"] = on(crits)
|
|
331
|
+
tokens["icon-on-info-base"] = on(infob)
|
|
332
|
+
tokens["icon-on-info-hover"] = on(infos)
|
|
333
|
+
tokens["icon-on-info-selected"] = on(infos)
|
|
334
|
+
|
|
335
|
+
tokens["icon-diff-add-base"] = diffAdd[10]
|
|
336
|
+
tokens["icon-diff-add-hover"] = diffAdd[isDark ? 9 : 11]
|
|
337
|
+
tokens["icon-diff-add-active"] = diffAdd[isDark ? 10 : 11]
|
|
338
|
+
tokens["icon-diff-delete-base"] = diffDelete[9]
|
|
339
|
+
tokens["icon-diff-delete-hover"] = diffDelete[isDark ? 10 : 10]
|
|
340
|
+
tokens["icon-diff-modified-base"] = modified()
|
|
341
|
+
|
|
342
|
+
if (colors.compact) {
|
|
343
|
+
tokens["syntax-comment"] = "var(--text-weak)"
|
|
344
|
+
tokens["syntax-regexp"] = "var(--text-base)"
|
|
345
|
+
tokens["syntax-string"] = content(colors.success, success)
|
|
346
|
+
tokens["syntax-keyword"] = content(colors.accent, accent)
|
|
347
|
+
tokens["syntax-primitive"] = content(colors.primary, primary)
|
|
348
|
+
tokens["syntax-operator"] = isDark ? "var(--text-weak)" : "var(--text-base)"
|
|
349
|
+
tokens["syntax-variable"] = "var(--text-strong)"
|
|
350
|
+
tokens["syntax-property"] = content(colors.info, info)
|
|
351
|
+
tokens["syntax-type"] = content(colors.warning, warning)
|
|
352
|
+
tokens["syntax-constant"] = content(colors.accent, accent)
|
|
353
|
+
tokens["syntax-punctuation"] = isDark ? "var(--text-weak)" : "var(--text-base)"
|
|
354
|
+
tokens["syntax-object"] = "var(--text-strong)"
|
|
355
|
+
tokens["syntax-success"] = success[10]
|
|
356
|
+
tokens["syntax-warning"] = amber[10]
|
|
357
|
+
tokens["syntax-critical"] = error[10]
|
|
358
|
+
tokens["syntax-info"] = content(colors.info, info)
|
|
359
|
+
tokens["syntax-diff-add"] = diffAdd[10]
|
|
360
|
+
tokens["syntax-diff-delete"] = diffDelete[10]
|
|
361
|
+
tokens["syntax-diff-unknown"] = "#ff0000"
|
|
362
|
+
|
|
363
|
+
tokens["markdown-heading"] = content(colors.primary, primary)
|
|
364
|
+
tokens["markdown-text"] = tokens["text-base"]
|
|
365
|
+
tokens["markdown-link"] = content(colors.interactive, interactive)
|
|
366
|
+
tokens["markdown-link-text"] = content(colors.info, info)
|
|
367
|
+
tokens["markdown-code"] = content(colors.success, success)
|
|
368
|
+
tokens["markdown-block-quote"] = content(colors.warning, warning)
|
|
369
|
+
tokens["markdown-emph"] = content(colors.warning, warning)
|
|
370
|
+
tokens["markdown-strong"] = content(colors.accent, accent)
|
|
371
|
+
tokens["markdown-horizontal-rule"] = tokens["border-base"]
|
|
372
|
+
tokens["markdown-list-item"] = content(colors.interactive, interactive)
|
|
373
|
+
tokens["markdown-list-enumeration"] = content(colors.info, info)
|
|
374
|
+
tokens["markdown-image"] = content(colors.interactive, interactive)
|
|
375
|
+
tokens["markdown-image-text"] = content(colors.info, info)
|
|
376
|
+
tokens["markdown-code-block"] = tokens["text-base"]
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (!colors.compact) {
|
|
380
|
+
tokens["syntax-comment"] = "var(--text-weak)"
|
|
381
|
+
tokens["syntax-regexp"] = "var(--text-base)"
|
|
382
|
+
tokens["syntax-string"] = isDark ? "#00ceb9" : "#006656"
|
|
383
|
+
tokens["syntax-keyword"] = "var(--text-weak)"
|
|
384
|
+
tokens["syntax-primitive"] = isDark ? "#ffba92" : "#fb4804"
|
|
385
|
+
tokens["syntax-operator"] = isDark ? "var(--text-weak)" : "var(--text-base)"
|
|
386
|
+
tokens["syntax-variable"] = "var(--text-strong)"
|
|
387
|
+
tokens["syntax-property"] = isDark ? "#ff9ae2" : "#ed6dc8"
|
|
388
|
+
tokens["syntax-type"] = isDark ? "#ecf58c" : "#596600"
|
|
389
|
+
tokens["syntax-constant"] = isDark ? "#93e9f6" : "#007b80"
|
|
390
|
+
tokens["syntax-punctuation"] = isDark ? "var(--text-weak)" : "var(--text-base)"
|
|
391
|
+
tokens["syntax-object"] = "var(--text-strong)"
|
|
392
|
+
tokens["syntax-success"] = success[10]
|
|
393
|
+
tokens["syntax-warning"] = amber[10]
|
|
394
|
+
tokens["syntax-critical"] = error[10]
|
|
395
|
+
tokens["syntax-info"] = isDark ? "#93e9f6" : "#0092a8"
|
|
396
|
+
tokens["syntax-diff-add"] = diffAdd[10]
|
|
397
|
+
tokens["syntax-diff-delete"] = diffDelete[10]
|
|
398
|
+
tokens["syntax-diff-unknown"] = "#ff0000"
|
|
399
|
+
|
|
400
|
+
tokens["markdown-heading"] = isDark ? "#9d7cd8" : "#d68c27"
|
|
401
|
+
tokens["markdown-text"] = isDark ? "#eeeeee" : "#1a1a1a"
|
|
402
|
+
tokens["markdown-link"] = isDark ? "#fab283" : "#3b7dd8"
|
|
403
|
+
tokens["markdown-link-text"] = isDark ? "#56b6c2" : "#318795"
|
|
404
|
+
tokens["markdown-code"] = isDark ? "#7fd88f" : "#3d9a57"
|
|
405
|
+
tokens["markdown-block-quote"] = isDark ? "#e5c07b" : "#b0851f"
|
|
406
|
+
tokens["markdown-emph"] = isDark ? "#e5c07b" : "#b0851f"
|
|
407
|
+
tokens["markdown-strong"] = isDark ? "#f5a742" : "#d68c27"
|
|
408
|
+
tokens["markdown-horizontal-rule"] = isDark ? "#808080" : "#8a8a8a"
|
|
409
|
+
tokens["markdown-list-item"] = isDark ? "#fab283" : "#3b7dd8"
|
|
410
|
+
tokens["markdown-list-enumeration"] = isDark ? "#56b6c2" : "#318795"
|
|
411
|
+
tokens["markdown-image"] = isDark ? "#fab283" : "#3b7dd8"
|
|
412
|
+
tokens["markdown-image-text"] = isDark ? "#56b6c2" : "#318795"
|
|
413
|
+
tokens["markdown-code-block"] = isDark ? "#eeeeee" : "#1a1a1a"
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
tokens["avatar-background-pink"] = isDark ? "#501b3f" : "#feeef8"
|
|
417
|
+
tokens["avatar-background-mint"] = isDark ? "#033a34" : "#e1fbf4"
|
|
418
|
+
tokens["avatar-background-orange"] = isDark ? "#5f2a06" : "#fff1e7"
|
|
419
|
+
tokens["avatar-background-purple"] = isDark ? "#432155" : "#f9f1fe"
|
|
420
|
+
tokens["avatar-background-cyan"] = isDark ? "#0f3058" : "#e7f9fb"
|
|
421
|
+
tokens["avatar-background-lime"] = isDark ? "#2b3711" : "#eefadc"
|
|
422
|
+
tokens["avatar-text-pink"] = isDark ? "#e34ba9" : "#cd1d8d"
|
|
423
|
+
tokens["avatar-text-mint"] = isDark ? "#95f3d9" : "#147d6f"
|
|
424
|
+
tokens["avatar-text-orange"] = isDark ? "#ff802b" : "#ed5f00"
|
|
425
|
+
tokens["avatar-text-purple"] = isDark ? "#9d5bd2" : "#8445bc"
|
|
426
|
+
tokens["avatar-text-cyan"] = isDark ? "#369eff" : "#0894b3"
|
|
427
|
+
tokens["avatar-text-lime"] = isDark ? "#c4f042" : "#5d770d"
|
|
428
|
+
|
|
429
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
430
|
+
tokens[key] = value
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (colors.compact && "text-weak" in overrides && !("text-weaker" in overrides)) {
|
|
434
|
+
const weak = tokens["text-weak"]
|
|
435
|
+
if (weak.startsWith("#")) {
|
|
436
|
+
tokens["text-weaker"] = shift(weak as HexColor, { l: isDark ? -0.12 : 0.12, c: 0.75 })
|
|
437
|
+
} else {
|
|
438
|
+
tokens["text-weaker"] = weak
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (colors.compact) {
|
|
443
|
+
if (!("markdown-text" in overrides)) {
|
|
444
|
+
tokens["markdown-text"] = tokens["text-base"]
|
|
445
|
+
}
|
|
446
|
+
if (!("markdown-code-block" in overrides)) {
|
|
447
|
+
tokens["markdown-code-block"] = tokens["text-base"]
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (!("text-stronger" in overrides)) {
|
|
452
|
+
tokens["text-stronger"] = tokens["text-strong"]
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return tokens
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
interface ThemeColors {
|
|
459
|
+
compact: boolean
|
|
460
|
+
neutral: HexColor
|
|
461
|
+
ink?: HexColor
|
|
462
|
+
primary: HexColor
|
|
463
|
+
accent: HexColor
|
|
464
|
+
success: HexColor
|
|
465
|
+
warning: HexColor
|
|
466
|
+
error: HexColor
|
|
467
|
+
info: HexColor
|
|
468
|
+
interactive: HexColor
|
|
469
|
+
diffAdd?: HexColor
|
|
470
|
+
diffDelete?: HexColor
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function getColors(variant: ThemeVariant): ThemeColors {
|
|
474
|
+
const input = variant as { palette?: unknown; seeds?: unknown }
|
|
475
|
+
if (input.palette && input.seeds) {
|
|
476
|
+
throw new Error("Theme variant cannot define both `palette` and `seeds`")
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
if (variant.palette) {
|
|
480
|
+
return {
|
|
481
|
+
compact: true,
|
|
482
|
+
neutral: variant.palette.neutral,
|
|
483
|
+
ink: variant.palette.ink,
|
|
484
|
+
primary: variant.palette.primary,
|
|
485
|
+
accent: variant.palette.accent ?? variant.palette.info,
|
|
486
|
+
success: variant.palette.success,
|
|
487
|
+
warning: variant.palette.warning,
|
|
488
|
+
error: variant.palette.error,
|
|
489
|
+
info: variant.palette.info,
|
|
490
|
+
interactive: variant.palette.interactive ?? variant.palette.primary,
|
|
491
|
+
diffAdd: variant.palette.diffAdd,
|
|
492
|
+
diffDelete: variant.palette.diffDelete,
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
if (variant.seeds) {
|
|
497
|
+
return {
|
|
498
|
+
compact: false,
|
|
499
|
+
neutral: variant.seeds.neutral,
|
|
500
|
+
ink: undefined,
|
|
501
|
+
primary: variant.seeds.primary,
|
|
502
|
+
accent: variant.seeds.info,
|
|
503
|
+
success: variant.seeds.success,
|
|
504
|
+
warning: variant.seeds.warning,
|
|
505
|
+
error: variant.seeds.error,
|
|
506
|
+
info: variant.seeds.info,
|
|
507
|
+
interactive: variant.seeds.interactive,
|
|
508
|
+
diffAdd: variant.seeds.diffAdd,
|
|
509
|
+
diffDelete: variant.seeds.diffDelete,
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
throw new Error("Theme variant requires `palette` or `seeds`")
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function generateNeutralAlphaScale(neutralScale: HexColor[], isDark: boolean): HexColor[] {
|
|
517
|
+
const alphas = isDark
|
|
518
|
+
? [0.038, 0.066, 0.1, 0.142, 0.19, 0.252, 0.334, 0.446, 0.58, 0.718, 0.854, 0.985]
|
|
519
|
+
: [0.03, 0.06, 0.1, 0.145, 0.2, 0.265, 0.35, 0.47, 0.61, 0.74, 0.86, 0.97]
|
|
520
|
+
|
|
521
|
+
return alphas.map((alpha) => blend(neutralScale[11], neutralScale[0], alpha))
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function getHex(value: ColorValue | undefined): HexColor | undefined {
|
|
525
|
+
if (!value?.startsWith("#")) return
|
|
526
|
+
return value as HexColor
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export function resolveTheme(theme: DesktopTheme): { light: ResolvedTheme; dark: ResolvedTheme } {
|
|
530
|
+
return {
|
|
531
|
+
light: resolveThemeVariant(theme.light, false),
|
|
532
|
+
dark: resolveThemeVariant(theme.dark, true),
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export function themeToCss(tokens: ResolvedTheme): string {
|
|
537
|
+
return Object.entries(tokens)
|
|
538
|
+
.map(([key, value]) => `--${key}: ${value};`)
|
|
539
|
+
.join("\n ")
|
|
540
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/desktop-theme.json",
|
|
3
|
+
"name": "AMOLED",
|
|
4
|
+
"id": "amoled",
|
|
5
|
+
"light": {
|
|
6
|
+
"palette": {
|
|
7
|
+
"neutral": "#f0f0f0",
|
|
8
|
+
"ink": "#0a0a0a",
|
|
9
|
+
"primary": "#6200ff",
|
|
10
|
+
"accent": "#ff0080",
|
|
11
|
+
"success": "#00e676",
|
|
12
|
+
"warning": "#ffab00",
|
|
13
|
+
"error": "#ff1744",
|
|
14
|
+
"info": "#00b0ff",
|
|
15
|
+
"diffAdd": "#00e676",
|
|
16
|
+
"diffDelete": "#ff1744"
|
|
17
|
+
},
|
|
18
|
+
"overrides": {
|
|
19
|
+
"syntax-comment": "#757575",
|
|
20
|
+
"syntax-keyword": "#d500f9",
|
|
21
|
+
"syntax-string": "#00e676",
|
|
22
|
+
"syntax-primitive": "#00b0ff",
|
|
23
|
+
"syntax-property": "#ff9100",
|
|
24
|
+
"syntax-constant": "#6200ff"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dark": {
|
|
28
|
+
"palette": {
|
|
29
|
+
"neutral": "#000000",
|
|
30
|
+
"ink": "#ffffff",
|
|
31
|
+
"primary": "#b388ff",
|
|
32
|
+
"accent": "#ff4081",
|
|
33
|
+
"success": "#00ff88",
|
|
34
|
+
"warning": "#ffea00",
|
|
35
|
+
"error": "#ff1744",
|
|
36
|
+
"info": "#18ffff",
|
|
37
|
+
"diffAdd": "#00ff88",
|
|
38
|
+
"diffDelete": "#ff1744"
|
|
39
|
+
},
|
|
40
|
+
"overrides": {
|
|
41
|
+
"syntax-comment": "#555555",
|
|
42
|
+
"syntax-keyword": "#ff00ff",
|
|
43
|
+
"syntax-string": "#00ff88",
|
|
44
|
+
"syntax-primitive": "#18ffff",
|
|
45
|
+
"syntax-property": "#ffea00",
|
|
46
|
+
"syntax-constant": "#b388ff"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/desktop-theme.json",
|
|
3
|
+
"name": "Aura",
|
|
4
|
+
"id": "aura",
|
|
5
|
+
"light": {
|
|
6
|
+
"palette": {
|
|
7
|
+
"neutral": "#f5f0ff",
|
|
8
|
+
"ink": "#2d2640",
|
|
9
|
+
"primary": "#a277ff",
|
|
10
|
+
"accent": "#d94f4f",
|
|
11
|
+
"success": "#40bf7a",
|
|
12
|
+
"warning": "#d9a24a",
|
|
13
|
+
"error": "#d94f4f",
|
|
14
|
+
"info": "#5bb8d9",
|
|
15
|
+
"diffAdd": "#b3e6cc",
|
|
16
|
+
"diffDelete": "#f5b3b3"
|
|
17
|
+
},
|
|
18
|
+
"overrides": {
|
|
19
|
+
"syntax-comment": "#8d88a3",
|
|
20
|
+
"syntax-keyword": "#7b5ae0",
|
|
21
|
+
"syntax-string": "#2b8a57",
|
|
22
|
+
"syntax-primitive": "#2f78b8",
|
|
23
|
+
"syntax-property": "#a96a22",
|
|
24
|
+
"syntax-type": "#2b8a57",
|
|
25
|
+
"syntax-constant": "#d94f4f"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"dark": {
|
|
29
|
+
"palette": {
|
|
30
|
+
"neutral": "#15141b",
|
|
31
|
+
"ink": "#edecee",
|
|
32
|
+
"primary": "#a277ff",
|
|
33
|
+
"accent": "#ff6767",
|
|
34
|
+
"success": "#61ffca",
|
|
35
|
+
"warning": "#ffca85",
|
|
36
|
+
"error": "#ff6767",
|
|
37
|
+
"info": "#82e2ff",
|
|
38
|
+
"diffAdd": "#61ffca",
|
|
39
|
+
"diffDelete": "#ff6767"
|
|
40
|
+
},
|
|
41
|
+
"overrides": {
|
|
42
|
+
"syntax-comment": "#6d6a7e",
|
|
43
|
+
"syntax-keyword": "#a277ff",
|
|
44
|
+
"syntax-string": "#61ffca",
|
|
45
|
+
"syntax-primitive": "#82e2ff",
|
|
46
|
+
"syntax-property": "#ffca85",
|
|
47
|
+
"syntax-type": "#61ffca",
|
|
48
|
+
"syntax-constant": "#ff6767"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|