mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
feat(ui): add Sakura, Espresso, Witch Hazel, E-Ink, and Dune themes (#66531)
This commit is contained in:
parent
d0ccd5a00a
commit
d382c66c6d
8 changed files with 348 additions and 19 deletions
|
|
@ -78,6 +78,9 @@ const names = new Map(
|
|||
cursor: "Cursor",
|
||||
cyberdream: "Cyberdream",
|
||||
dracula: "Dracula",
|
||||
dune: "Dune",
|
||||
eink: "E-Ink",
|
||||
espresso: "Espresso",
|
||||
everforest: "Everforest",
|
||||
flexoki: "Flexoki",
|
||||
github: "GitHub",
|
||||
|
|
@ -99,6 +102,7 @@ const names = new Map(
|
|||
palenight: "Palenight",
|
||||
poimandres: "Poimandres",
|
||||
rosepine: "Rose Pine",
|
||||
sakura: "Sakura",
|
||||
shadesofpurple: "Shades of Purple",
|
||||
solarized: "Solarized",
|
||||
synthwave84: "Synthwave '84",
|
||||
|
|
@ -106,6 +110,7 @@ const names = new Map(
|
|||
vercel: "Vercel",
|
||||
vesper: "Vesper",
|
||||
vscode: "VS Code",
|
||||
witchhazel: "Witch Hazel",
|
||||
zenburn: "Zenburn",
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
62
packages/ui/src/theme/themes/dune.json
Normal file
62
packages/ui/src/theme/themes/dune.json
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"$schema": "https://opencode.ai/desktop-theme.json",
|
||||
"name": "Dune",
|
||||
"id": "dune",
|
||||
"light": {
|
||||
"palette": {
|
||||
"neutral": "#f6ebd2",
|
||||
"ink": "#261e0c",
|
||||
"primary": "#825600",
|
||||
"accent": "#963919",
|
||||
"success": "#32662e",
|
||||
"warning": "#8c5200",
|
||||
"error": "#ad261f",
|
||||
"info": "#1a626b",
|
||||
"interactive": "#825600",
|
||||
"diffAdd": "#32662e",
|
||||
"diffDelete": "#ad261f"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#5e5135",
|
||||
"syntax-comment": "#695b3d",
|
||||
"syntax-keyword": "#7d5200",
|
||||
"syntax-string": "#2f612b",
|
||||
"syntax-primitive": "#185d66",
|
||||
"syntax-property": "#913617",
|
||||
"syntax-type": "#6b4b00",
|
||||
"syntax-constant": "#a12d21"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-contrast": "#523805"
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
"palette": {
|
||||
"neutral": "#1b1811",
|
||||
"ink": "#f0e9d6",
|
||||
"primary": "#e6b450",
|
||||
"accent": "#e8835c",
|
||||
"success": "#95c76f",
|
||||
"warning": "#f2c45a",
|
||||
"error": "#eb6b5e",
|
||||
"info": "#73c4c9",
|
||||
"interactive": "#e6b450",
|
||||
"diffAdd": "#95c76f",
|
||||
"diffDelete": "#eb6b5e"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#ab9f84",
|
||||
"syntax-comment": "#94886e",
|
||||
"syntax-keyword": "#edc062",
|
||||
"syntax-string": "#9fd179",
|
||||
"syntax-primitive": "#7ecdd1",
|
||||
"syntax-property": "#ed916d",
|
||||
"syntax-type": "#f5cf73",
|
||||
"syntax-constant": "#f08073"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-icon-button-contrast": "#ebd08d",
|
||||
"v2-icon-icon-inverse": "var(--v2-grey-1100)"
|
||||
}
|
||||
}
|
||||
}
|
||||
63
packages/ui/src/theme/themes/eink.json
Normal file
63
packages/ui/src/theme/themes/eink.json
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"$schema": "https://opencode.ai/desktop-theme.json",
|
||||
"name": "E-Ink",
|
||||
"id": "eink",
|
||||
"light": {
|
||||
"palette": {
|
||||
"neutral": "#ebe9e2",
|
||||
"ink": "#141413",
|
||||
"primary": "#3b3b3e",
|
||||
"accent": "#4d4d52",
|
||||
"success": "#285238",
|
||||
"warning": "#634c1e",
|
||||
"error": "#732929",
|
||||
"info": "#3b3b3e",
|
||||
"interactive": "#3b3b3e",
|
||||
"diffAdd": "#285238",
|
||||
"diffDelete": "#732929"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#4f4f4b",
|
||||
"syntax-comment": "#595955",
|
||||
"syntax-keyword": "#141413",
|
||||
"syntax-string": "#333331",
|
||||
"syntax-primitive": "#212120",
|
||||
"syntax-property": "#40403d",
|
||||
"syntax-type": "#292927",
|
||||
"syntax-constant": "#333331",
|
||||
"syntax-operator": "#4a4a47",
|
||||
"syntax-punctuation": "#52524e"
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
"palette": {
|
||||
"neutral": "#171716",
|
||||
"ink": "#e6e5e0",
|
||||
"primary": "#a8a8ad",
|
||||
"accent": "#c2c2c7",
|
||||
"success": "#8ab89a",
|
||||
"warning": "#c9b382",
|
||||
"error": "#cf8a8a",
|
||||
"info": "#a8a8ad",
|
||||
"interactive": "#a8a8ad",
|
||||
"diffAdd": "#8ab89a",
|
||||
"diffDelete": "#cf8a8a"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#969590",
|
||||
"syntax-comment": "#82817c",
|
||||
"syntax-keyword": "#f2f1ed",
|
||||
"syntax-string": "#bfbeb8",
|
||||
"syntax-primitive": "#dcdbd6",
|
||||
"syntax-property": "#b3b2ac",
|
||||
"syntax-type": "#d4d3ce",
|
||||
"syntax-constant": "#c7c6c0",
|
||||
"syntax-operator": "#9e9d98",
|
||||
"syntax-punctuation": "#969590"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-icon-button-contrast": "#d4d3ce",
|
||||
"v2-icon-icon-inverse": "var(--v2-grey-1100)"
|
||||
}
|
||||
}
|
||||
}
|
||||
62
packages/ui/src/theme/themes/espresso.json
Normal file
62
packages/ui/src/theme/themes/espresso.json
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"$schema": "https://opencode.ai/desktop-theme.json",
|
||||
"name": "Espresso",
|
||||
"id": "espresso",
|
||||
"light": {
|
||||
"palette": {
|
||||
"neutral": "#f1e4d3",
|
||||
"ink": "#291a10",
|
||||
"primary": "#964b18",
|
||||
"accent": "#7a354e",
|
||||
"success": "#2e6b35",
|
||||
"warning": "#855206",
|
||||
"error": "#a6281e",
|
||||
"info": "#266170",
|
||||
"interactive": "#964b18",
|
||||
"diffAdd": "#2e6b35",
|
||||
"diffDelete": "#a6281e"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#634b3b",
|
||||
"syntax-comment": "#6b5343",
|
||||
"syntax-keyword": "#8f4614",
|
||||
"syntax-string": "#2b6632",
|
||||
"syntax-primitive": "#235c6b",
|
||||
"syntax-property": "#75324a",
|
||||
"syntax-type": "#7d4d06",
|
||||
"syntax-constant": "#9c3221"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-contrast": "#4d2810"
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
"palette": {
|
||||
"neutral": "#1e1612",
|
||||
"ink": "#efe1d4",
|
||||
"primary": "#e09052",
|
||||
"accent": "#d98ca3",
|
||||
"success": "#8ec479",
|
||||
"warning": "#e8bd70",
|
||||
"error": "#e86f61",
|
||||
"info": "#7ec2cf",
|
||||
"interactive": "#e09052",
|
||||
"diffAdd": "#8ec479",
|
||||
"diffDelete": "#e86f61"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#ad9786",
|
||||
"syntax-comment": "#968070",
|
||||
"syntax-keyword": "#e59a5e",
|
||||
"syntax-string": "#98cc82",
|
||||
"syntax-primitive": "#86cad6",
|
||||
"syntax-property": "#e09ab0",
|
||||
"syntax-type": "#ecc57c",
|
||||
"syntax-constant": "#eb8475"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-icon-button-contrast": "#e6c3a5",
|
||||
"v2-icon-icon-inverse": "var(--v2-grey-1100)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,8 @@
|
|||
"id": "poimandres",
|
||||
"light": {
|
||||
"palette": {
|
||||
"neutral": "#f4f7fb",
|
||||
"ink": "#1b1e28",
|
||||
"neutral": "#e8f0fa",
|
||||
"ink": "#182436",
|
||||
"primary": "#1a6fb5",
|
||||
"accent": "#a83b72",
|
||||
"success": "#137a65",
|
||||
|
|
@ -17,14 +17,14 @@
|
|||
"diffDelete": "#b5386c"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#525d73",
|
||||
"syntax-comment": "#5a667d",
|
||||
"syntax-keyword": "#1a6fb5",
|
||||
"syntax-string": "#10735e",
|
||||
"syntax-primitive": "#1f6a8c",
|
||||
"syntax-property": "#3f5875",
|
||||
"syntax-type": "#734696",
|
||||
"syntax-constant": "#a83b72"
|
||||
"text-weak": "#475973",
|
||||
"syntax-comment": "#50627d",
|
||||
"syntax-keyword": "#1463a8",
|
||||
"syntax-string": "#0d6b57",
|
||||
"syntax-primitive": "#186182",
|
||||
"syntax-property": "#364f6b",
|
||||
"syntax-type": "#6b3e8f",
|
||||
"syntax-constant": "#9e3368"
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
|
|
|
|||
62
packages/ui/src/theme/themes/sakura.json
Normal file
62
packages/ui/src/theme/themes/sakura.json
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"$schema": "https://opencode.ai/desktop-theme.json",
|
||||
"name": "Sakura",
|
||||
"id": "sakura",
|
||||
"light": {
|
||||
"palette": {
|
||||
"neutral": "#fde8f0",
|
||||
"ink": "#301122",
|
||||
"primary": "#c22575",
|
||||
"accent": "#8f2d8c",
|
||||
"success": "#1e754c",
|
||||
"warning": "#945a00",
|
||||
"error": "#c41d46",
|
||||
"info": "#9e2b82",
|
||||
"interactive": "#c22575",
|
||||
"diffAdd": "#1e754c",
|
||||
"diffDelete": "#c41d46"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#6e3d57",
|
||||
"syntax-comment": "#784862",
|
||||
"syntax-keyword": "#ad1a66",
|
||||
"syntax-string": "#1d7048",
|
||||
"syntax-primitive": "#7d247a",
|
||||
"syntax-property": "#662873",
|
||||
"syntax-type": "#855100",
|
||||
"syntax-constant": "#b81f6d"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-contrast": "#61173d"
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
"palette": {
|
||||
"neutral": "#24141f",
|
||||
"ink": "#f9e8f1",
|
||||
"primary": "#f26cb2",
|
||||
"accent": "#d58cff",
|
||||
"success": "#7ddba6",
|
||||
"warning": "#f5c77e",
|
||||
"error": "#ff6b8b",
|
||||
"info": "#ffa6d8",
|
||||
"interactive": "#f26cb2",
|
||||
"diffAdd": "#7ddba6",
|
||||
"diffDelete": "#ff6b8b"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#bf97ad",
|
||||
"syntax-comment": "#a37b92",
|
||||
"syntax-keyword": "#ff85c2",
|
||||
"syntax-string": "#8be3b0",
|
||||
"syntax-primitive": "#d99cff",
|
||||
"syntax-property": "#ffb5df",
|
||||
"syntax-type": "#f7cf8b",
|
||||
"syntax-constant": "#ff94b2"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-icon-button-contrast": "#f5bad7",
|
||||
"v2-icon-icon-inverse": "var(--v2-grey-1100)"
|
||||
}
|
||||
}
|
||||
}
|
||||
62
packages/ui/src/theme/themes/witchhazel.json
Normal file
62
packages/ui/src/theme/themes/witchhazel.json
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"$schema": "https://opencode.ai/desktop-theme.json",
|
||||
"name": "Witch Hazel",
|
||||
"id": "witchhazel",
|
||||
"light": {
|
||||
"palette": {
|
||||
"neutral": "#f1e6fb",
|
||||
"ink": "#251638",
|
||||
"primary": "#732bc4",
|
||||
"accent": "#ad1f73",
|
||||
"success": "#177050",
|
||||
"warning": "#8a5700",
|
||||
"error": "#b51e49",
|
||||
"info": "#126682",
|
||||
"interactive": "#732bc4",
|
||||
"diffAdd": "#177050",
|
||||
"diffDelete": "#b51e49"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#574370",
|
||||
"syntax-comment": "#624d7c",
|
||||
"syntax-keyword": "#166b4c",
|
||||
"syntax-string": "#12637d",
|
||||
"syntax-primitive": "#6e27bd",
|
||||
"syntax-property": "#852396",
|
||||
"syntax-type": "#825200",
|
||||
"syntax-constant": "#ad1f73"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-contrast": "#461d78"
|
||||
}
|
||||
},
|
||||
"dark": {
|
||||
"palette": {
|
||||
"neutral": "#282236",
|
||||
"ink": "#f8f8f2",
|
||||
"primary": "#ceb1ff",
|
||||
"accent": "#ffb8d1",
|
||||
"success": "#c2ffdf",
|
||||
"warning": "#fff352",
|
||||
"error": "#ff6e8e",
|
||||
"info": "#1bc5e0",
|
||||
"interactive": "#ceb1ff",
|
||||
"diffAdd": "#c2ffdf",
|
||||
"diffDelete": "#ff6e8e"
|
||||
},
|
||||
"overrides": {
|
||||
"text-weak": "#b5abc9",
|
||||
"syntax-comment": "#9e93b5",
|
||||
"syntax-keyword": "#c2ffdf",
|
||||
"syntax-string": "#7ce4f7",
|
||||
"syntax-primitive": "#ceb1ff",
|
||||
"syntax-property": "#ffb8d1",
|
||||
"syntax-type": "#fff2a6",
|
||||
"syntax-constant": "#c5a3ff"
|
||||
},
|
||||
"v2Overrides": {
|
||||
"v2-background-bg-icon-button-contrast": "#decaff",
|
||||
"v2-icon-icon-inverse": "var(--v2-grey-1100)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ interface PaletteInput {
|
|||
interface HueScaleAnchors {
|
||||
bgBase: HexColor
|
||||
textContrast: HexColor
|
||||
monochrome?: boolean
|
||||
}
|
||||
|
||||
function clamp(v: number, min: number, max: number) {
|
||||
|
|
@ -97,11 +98,11 @@ function generateV2NeutralScale(neutral: HexColor, ink: HexColor, isDark: boolea
|
|||
})
|
||||
}
|
||||
|
||||
const l50 = clamp(n.l, 0.91, 1)
|
||||
const l100 = l50 - 0.018
|
||||
const l200 = l50 - 0.042
|
||||
const l300 = l50 - 0.062
|
||||
const l400 = l50 - 0.108
|
||||
const l50 = clamp(n.l, 0.87, 1)
|
||||
const l100 = l50 - 0.022
|
||||
const l200 = l50 - 0.048
|
||||
const l300 = l50 - 0.072
|
||||
const l400 = l50 - 0.118
|
||||
|
||||
const l1100 = clamp(k.l, 0.16, 0.28)
|
||||
const l1200 = Math.max(0.11, l1100 - 0.06)
|
||||
|
|
@ -109,6 +110,8 @@ function generateV2NeutralScale(neutral: HexColor, ink: HexColor, isDark: boolea
|
|||
const l900 = l1100 + 0.1
|
||||
const l800 = l1100 + 0.15
|
||||
const midSpan = l400 - l800
|
||||
const darkHue = k.c >= 0.01 ? k.h : hue
|
||||
const darkC = Math.max(baseC, Math.min(k.c, 0.055))
|
||||
|
||||
const lightSteps = [
|
||||
l50,
|
||||
|
|
@ -127,9 +130,15 @@ function generateV2NeutralScale(neutral: HexColor, ink: HexColor, isDark: boolea
|
|||
]
|
||||
|
||||
return lightSteps.map((l, idx) => {
|
||||
const chromaScale = idx === 0 ? 1 : idx <= 4 ? 0.95 : idx <= 7 ? 0.65 : 0.5
|
||||
if (idx >= 8) {
|
||||
const darkScale = idx === 10 ? 1.1 : 0.9
|
||||
|
||||
return oklchToHexExact({ l, c: baseC * chromaScale, h: hue })
|
||||
return oklchToHexExact({ l, c: Math.min(darkC * darkScale, 0.062), h: darkHue })
|
||||
}
|
||||
|
||||
const chromaScale = idx === 0 ? 1 : idx === 1 ? 1.14 : idx === 2 ? 1.24 : idx <= 4 ? 1.28 : 0.85
|
||||
|
||||
return oklchToHexExact({ l, c: Math.min(baseC * chromaScale, 0.072), h: hue })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +150,8 @@ function generateV2NeutralScale(neutral: HexColor, ink: HexColor, isDark: boolea
|
|||
function generateV2HueScale(seed: HexColor, isDark: boolean, anchors: HueScaleAnchors): HexColor[] {
|
||||
const base = hexToOklch(seed)
|
||||
const bgBaseL = hexToOklch(anchors.bgBase).l
|
||||
const chroma = clamp(base.c, 0.075, 0.22)
|
||||
const mono = Boolean(anchors.monochrome) && base.c < 0.025
|
||||
const chroma = mono ? base.c : clamp(base.c, 0.075, 0.22)
|
||||
const h = base.h
|
||||
|
||||
const step100 = oklchToHexExact({
|
||||
|
|
@ -163,7 +173,7 @@ function generateV2HueScale(seed: HexColor, isDark: boolean, anchors: HueScaleAn
|
|||
|
||||
const raw1200 = oklchToHexExact({
|
||||
l: isDark ? clamp(bgBaseL + 0.035, 0.2, 0.31) : 0.23,
|
||||
c: clamp(chroma * 0.42, 0.035, 0.072),
|
||||
c: mono ? chroma * 0.42 : clamp(chroma * 0.42, 0.035, 0.072),
|
||||
h,
|
||||
})
|
||||
|
||||
|
|
@ -269,9 +279,12 @@ export function generateV2Primitives(variant: ThemeVariant, isDark: boolean): Re
|
|||
const colors = readPalette(variant)
|
||||
const grey = generateV2NeutralScale(colors.neutral, colors.ink, isDark)
|
||||
|
||||
const monochrome = hexToOklch(colors.primary).c < 0.025 && hexToOklch(colors.interactive).c < 0.025
|
||||
|
||||
const anchors: HueScaleAnchors = {
|
||||
bgBase: isDark ? grey[11]! : grey[0]!,
|
||||
textContrast: grey[0]!,
|
||||
monochrome,
|
||||
}
|
||||
|
||||
const blue = generateV2HueScale(colors.interactive, isDark, anchors)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue