Use new theme vars (#63)

This PR swaps the theme to use the new stuff from the Theme Studio
This commit is contained in:
Gregory Schier
2024-08-13 07:44:28 -07:00
committed by GitHub
parent a0950ce5b8
commit b5242b9a3f
79 changed files with 1113 additions and 1004 deletions

View File

@@ -1,43 +1,46 @@
module.exports = { module.exports = {
extends: [ extends: [
"eslint:recommended", 'eslint:recommended',
"plugin:react/recommended", 'plugin:react/recommended',
"plugin:react-hooks/recommended", 'plugin:react-hooks/recommended',
"plugin:import/recommended", 'plugin:import/recommended',
"plugin:jsx-a11y/recommended", 'plugin:jsx-a11y/recommended',
"plugin:@typescript-eslint/recommended", 'plugin:@typescript-eslint/recommended',
"eslint-config-prettier" 'eslint-config-prettier',
], ],
parser: "@typescript-eslint/parser", parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
project: ["./tsconfig.json"] project: ['./tsconfig.json'],
}, },
ignorePatterns: [ ignorePatterns: [
"scripts/**/*", 'scripts/**/*',
"plugin-runtime/**/*", 'plugin-runtime/**/*',
"plugin-runtime-types/**/*", 'plugin-runtime-types/**/*',
"src-tauri/**/*", 'src-tauri/**/*',
"plugins/**/*", 'plugins/**/*',
], ],
settings: { settings: {
react: { react: {
version: "detect" version: 'detect',
}, },
"import/resolver": { 'import/resolver': {
node: { node: {
paths: ["src-web"], paths: ['src-web'],
extensions: [".ts", ".tsx"] extensions: ['.ts', '.tsx'],
} },
} },
}, },
rules: { rules: {
"jsx-a11y/no-autofocus": "off", 'jsx-a11y/no-autofocus': 'off',
"react/react-in-jsx-scope": "off", 'react/react-in-jsx-scope': 'off',
"import/no-unresolved": "off", 'import/no-unresolved': 'off',
"@typescript-eslint/consistent-type-imports": ["error", { '@typescript-eslint/consistent-type-imports': [
prefer: "type-imports", 'error',
disallowTypeAnnotations: true, {
fixStyle: "separate-type-imports" prefer: 'type-imports',
}] disallowTypeAnnotations: true,
} fixStyle: 'separate-type-imports',
},
],
},
}; };

View File

@@ -1 +1 @@
{"main":{"identifier":"main","description":"Main permissions","local":true,"windows":["*"],"permissions":["core:event:allow-emit","core:event:allow-listen","core:event:allow-unlisten","os:allow-os-type","clipboard-manager:allow-write-text","clipboard-manager:allow-clear","clipboard-manager:allow-read-text","dialog:allow-open","dialog:allow-save","fs:allow-read-file","fs:allow-read-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPDATA"},{"path":"$APPDATA/**"}]},"shell:allow-open","core:webview:allow-set-webview-zoom","core:window:allow-close","core:window:allow-is-fullscreen","core:window:allow-maximize","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-set-decorations","core:window:allow-set-title","core:window:allow-start-dragging","core:window:allow-unmaximize","core:window:allow-theme","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text"]}} {"main":{"identifier":"main","description":"Main permissions","local":true,"windows":["*"],"permissions":["core:event:allow-emit","core:event:allow-listen","core:event:allow-unlisten","os:allow-os-type","clipboard-manager:allow-clear","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","dialog:allow-open","dialog:allow-save","fs:allow-read-file","fs:allow-read-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPDATA"},{"path":"$APPDATA/**"}]},"shell:allow-open","core:webview:allow-set-webview-zoom","core:window:allow-close","core:window:allow-is-fullscreen","core:window:allow-maximize","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-set-decorations","core:window:allow-set-title","core:window:allow-start-dragging","core:window:allow-unmaximize","core:window:allow-theme","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text"]}}

View File

@@ -263,7 +263,7 @@ export function CommandPalette({ onClose }: { onClose: () => void }) {
searchText: fallbackRequestName(r), searchText: fallbackRequestName(r),
label: ( label: (
<HStack space={2}> <HStack space={2}>
<HttpMethodTag className="text-fg-subtler" request={r} /> <HttpMethodTag className="text-text-subtlest" request={r} />
<div className="truncate">{fallbackRequestName(r)}</div> <div className="truncate">{fallbackRequestName(r)}</div>
</HStack> </HStack>
), ),
@@ -389,7 +389,7 @@ export function CommandPalette({ onClose }: { onClose: () => void }) {
hideLabel hideLabel
leftSlot={ leftSlot={
<div className="h-md w-10 flex justify-center items-center"> <div className="h-md w-10 flex justify-center items-center">
<Icon icon="search" className="text-fg-subtle" /> <Icon icon="search" className="text-text-subtle" />
</div> </div>
} }
name="command" name="command"
@@ -446,9 +446,9 @@ function CommandPaletteItem({
justify="start" justify="start"
className={classNames( className={classNames(
'w-full h-sm flex items-center rounded px-1.5', 'w-full h-sm flex items-center rounded px-1.5',
'hover:text-fg', 'hover:text',
active && 'bg-background-highlight-secondary text-fg', active && 'bg-surface-highlight-secondary text',
!active && 'text-fg-subtle', !active && 'text-text-subtle',
)} )}
> >
<span className="truncate">{children}</span> <span className="truncate">{children}</span>

View File

@@ -29,7 +29,7 @@ export const CookieDialog = function ({ cookieJarId }: Props) {
return ( return (
<div className="pb-2"> <div className="pb-2">
<table className="w-full text-sm mb-auto min-w-full max-w-full divide-y divide-background-highlight"> <table className="w-full text-sm mb-auto min-w-full max-w-full divide-y divide-surface-highlight">
<thead> <thead>
<tr> <tr>
<th className="py-2 text-left">Domain</th> <th className="py-2 text-left">Domain</th>
@@ -37,13 +37,13 @@ export const CookieDialog = function ({ cookieJarId }: Props) {
<th className="py-2 pl-4"></th> <th className="py-2 pl-4"></th>
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-background-highlight-secondary"> <tbody className="divide-y divide-surface-highlight">
{cookieJar?.cookies.map((c: Cookie) => ( {cookieJar?.cookies.map((c: Cookie) => (
<tr key={c.domain + c.raw_cookie}> <tr key={c.domain + c.raw_cookie}>
<td className="py-2 select-text cursor-text font-mono font-semibold max-w-0"> <td className="py-2 select-text cursor-text font-mono font-semibold max-w-0">
{cookieDomain(c)} {cookieDomain(c)}
</td> </td>
<td className="py-2 pl-4 select-text cursor-text font-mono text-fg-subtle whitespace-nowrap overflow-x-auto max-w-[200px] hide-scrollbars"> <td className="py-2 pl-4 select-text cursor-text font-mono text-text-subtle whitespace-nowrap overflow-x-auto max-w-[200px] hide-scrollbars">
{c.raw_cookie} {c.raw_cookie}
</td> </td>
<td className="max-w-0 w-10"> <td className="max-w-0 w-10">

View File

@@ -22,7 +22,7 @@ export function DefaultLayout() {
transition={{ duration: 0.1, delay: 0.1 }} transition={{ duration: 0.1, delay: 0.1 }}
className={classNames( className={classNames(
'w-full h-full', 'w-full h-full',
osInfo?.osType === 'linux' && 'border border-background-highlight-secondary', osInfo?.osType === 'linux' && 'border border-border-subtle',
)} )}
> >
<Outlet /> <Outlet />

View File

@@ -14,7 +14,7 @@ export const DropMarker = memo(
'relative w-full h-0 overflow-visible pointer-events-none', 'relative w-full h-0 overflow-visible pointer-events-none',
)} )}
> >
<div className="absolute z-50 left-2 right-2 -bottom-[0.1rem] h-[0.2rem] bg-fg-primary rounded-full" /> <div className="absolute z-50 left-2 right-2 -bottom-[0.1rem] h-[0.2rem] bg-primary rounded-full" />
</div> </div>
); );
}, },

View File

@@ -12,8 +12,8 @@ export function EmptyStateText({ children, className }: Props) {
<div <div
className={classNames( className={classNames(
className, className,
'rounded-lg border border-dashed border-background-highlight', 'rounded-lg border border-dashed border-border-subtle',
'h-full py-2 text-fg-subtler flex items-center justify-center italic', 'h-full py-2 text-text-subtlest flex items-center justify-center italic',
)} )}
> >
{children} {children}

View File

@@ -71,8 +71,8 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
size="sm" size="sm"
className={classNames( className={classNames(
className, className,
'text-fg !px-2 truncate', 'text !px-2 truncate',
activeEnvironment == null && 'text-fg-subtler italic', activeEnvironment == null && 'text-text-subtlest italic',
)} )}
{...buttonProps} {...buttonProps}
> >

View File

@@ -68,7 +68,7 @@ export const EnvironmentEditDialog = function ({ initialEnvironment }: Props) {
color="custom" color="custom"
title="Add sub environment" title="Add sub environment"
icon="plusCircle" icon="plusCircle"
iconClassName="text-fg-subtler group-hover:text-fg-subtle" iconClassName="text-text-subtlest group-hover:text-text-subtle"
className="group" className="group"
onClick={handleCreateEnvironment} onClick={handleCreateEnvironment}
/> />
@@ -97,7 +97,7 @@ export const EnvironmentEditDialog = function ({ initialEnvironment }: Props) {
secondSlot={() => secondSlot={() =>
activeWorkspace != null && ( activeWorkspace != null && (
<EnvironmentEditor <EnvironmentEditor
className="pt-2 border-l border-background-highlight-secondary" className="pt-2 border-l border-border-subtle"
environment={selectedEnvironment} environment={selectedEnvironment}
workspace={activeWorkspace} workspace={activeWorkspace}
/> />
@@ -175,7 +175,7 @@ const EnvironmentEditor = function ({
<Heading className="w-full flex items-center gap-1"> <Heading className="w-full flex items-center gap-1">
<div>{environment?.name ?? 'Global Variables'}</div> <div>{environment?.name ?? 'Global Variables'}</div>
<IconButton <IconButton
iconClassName="text-fg-subtler" iconClassName="text-text-subtlest"
size="sm" size="sm"
icon={valueVisibility.value ? 'eye' : 'eyeClosed'} icon={valueVisibility.value ? 'eye' : 'eyeClosed'}
title={valueVisibility.value ? 'Hide Values' : 'Reveal Values'} title={valueVisibility.value ? 'Hide Values' : 'Reveal Values'}
@@ -238,7 +238,7 @@ function SidebarButton({
className={classNames( className={classNames(
className, className,
'w-full grid grid-cols-[minmax(0,1fr)_auto] items-center gap-0.5', 'w-full grid grid-cols-[minmax(0,1fr)_auto] items-center gap-0.5',
'px-2', // Padding to show focus border 'px-2', // Padding to show the focus border
)} )}
> >
<Button <Button
@@ -246,7 +246,7 @@ function SidebarButton({
size="xs" size="xs"
className={classNames( className={classNames(
'w-full', 'w-full',
active ? 'text-fg bg-background-active' : 'text-fg-subtle hover:text-fg', active ? 'text bg-surface-active' : 'text-text-subtle hover:text',
)} )}
justify="start" justify="start"
onClick={onClick} onClick={onClick}

View File

@@ -59,7 +59,7 @@ export function ExportDataDialog({
const noneSelected = numSelected === 0; const noneSelected = numSelected === 0;
return ( return (
<VStack space={3} className="w-full mb-3 px-4"> <VStack space={3} className="w-full mb-3 px-4">
<table className="w-full mb-auto min-w-full max-w-full divide-y divide-background-highlight-secondary"> <table className="w-full mb-auto min-w-full max-w-full divide-y divide-surface-highlight">
<thead> <thead>
<tr> <tr>
<th className="w-6 min-w-0 py-2 text-left pl-1"> <th className="w-6 min-w-0 py-2 text-left pl-1">
@@ -76,7 +76,7 @@ export function ExportDataDialog({
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-background-highlight-secondary"> <tbody className="divide-y divide-surface-highlight">
{workspaces.map((w) => ( {workspaces.map((w) => (
<tr key={w.id}> <tr key={w.id}>
<td className="min-w-0 py-1 pl-1"> <td className="min-w-0 py-1 pl-1">
@@ -90,7 +90,7 @@ export function ExportDataDialog({
/> />
</td> </td>
<td <td
className="py-1 pl-4 text-fg whitespace-nowrap overflow-x-auto hide-scrollbars" className="py-1 pl-4 text whitespace-nowrap overflow-x-auto hide-scrollbars"
onClick={() => setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))} onClick={() => setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))}
> >
{w.name} {w.id === activeWorkspace.id ? '(current workspace)' : ''} {w.name} {w.id === activeWorkspace.id ? '(current workspace)' : ''}

View File

@@ -109,7 +109,7 @@ export function GrpcConnectionLayout({ style }: Props) {
className={classNames( className={classNames(
'x-theme-responsePane', 'x-theme-responsePane',
'max-h-full h-full grid grid-rows-[minmax(0,1fr)] grid-cols-1', 'max-h-full h-full grid grid-rows-[minmax(0,1fr)] grid-cols-1',
'bg-background rounded-md border border-background-highlight', 'bg-surface rounded-md border border-border-subtle',
'shadow relative', 'shadow relative',
)} )}
> >

View File

@@ -67,7 +67,7 @@ export function GrpcConnectionMessagesPane({ style, methodType, activeRequest }:
<HStack space={2}> <HStack space={2}>
<span>{events.length} Messages</span> <span>{events.length} Messages</span>
{isResponseLoading(activeConnection) && ( {isResponseLoading(activeConnection) && (
<Icon icon="refresh" size="sm" spin className="text-fg-subtler" /> <Icon icon="refresh" size="sm" spin className="text-text-subtlest" />
)} )}
</HStack> </HStack>
<RecentConnectionsDropdown <RecentConnectionsDropdown
@@ -112,7 +112,7 @@ export function GrpcConnectionMessagesPane({ style, methodType, activeRequest }:
Message {activeEvent.eventType === 'client_message' ? 'Sent' : 'Received'} Message {activeEvent.eventType === 'client_message' ? 'Sent' : 'Received'}
</div> </div>
{!showLarge && activeEvent.content.length > 1000 * 1000 ? ( {!showLarge && activeEvent.content.length > 1000 * 1000 ? (
<VStack space={2} className="italic text-fg-subtler"> <VStack space={2} className="italic text-text-subtlest">
Message previews larger than 1MB are hidden Message previews larger than 1MB are hidden
<div> <div>
<Button <Button
@@ -143,7 +143,7 @@ export function GrpcConnectionMessagesPane({ style, methodType, activeRequest }:
{activeEvent.content} {activeEvent.content}
</div> </div>
{activeEvent.error && ( {activeEvent.error && (
<div className="select-text cursor-text text-sm font-mono py-1 text-fg-warning"> <div className="select-text cursor-text text-sm font-mono py-1 text-warning">
{activeEvent.error} {activeEvent.error}
</div> </div>
)} )}
@@ -188,21 +188,21 @@ function EventRow({
className={classNames( className={classNames(
'w-full grid grid-cols-[auto_minmax(0,3fr)_auto] gap-2 items-center text-left', 'w-full grid grid-cols-[auto_minmax(0,3fr)_auto] gap-2 items-center text-left',
'px-1.5 py-1 font-mono cursor-default group focus:outline-none rounded', 'px-1.5 py-1 font-mono cursor-default group focus:outline-none rounded',
isActive && '!bg-background-highlight-secondary !text-fg', isActive && '!bg-surface-highlight-secondary !text',
'text-fg-subtle hover:text-fg', 'text-text-subtle hover:text',
)} )}
> >
<Icon <Icon
className={ className={
eventType === 'server_message' eventType === 'server_message'
? 'text-fg-info' ? 'text-info'
: eventType === 'client_message' : eventType === 'client_message'
? 'text-fg-primary' ? 'text-primary'
: eventType === 'error' || (status != null && status > 0) : eventType === 'error' || (status != null && status > 0)
? 'text-fg-danger' ? 'text-danger'
: eventType === 'connection_end' : eventType === 'connection_end'
? 'text-fg-success' ? 'text-success'
: 'text-fg-subtle' : 'text-text-subtle'
} }
title={ title={
eventType === 'server_message' eventType === 'server_message'
@@ -229,7 +229,7 @@ function EventRow({
/> />
<div className={classNames('w-full truncate text-xs')}> <div className={classNames('w-full truncate text-xs')}>
{content.slice(0, 1000)} {content.slice(0, 1000)}
{error && <span className="text-fg-warning"> ({error})</span>} {error && <span className="text-warning"> ({error})</span>}
</div> </div>
<div className={classNames('opacity-50 text-xs')}> <div className={classNames('opacity-50 text-xs')}>
{format(createdAt + 'Z', 'HH:mm:ss.SSS')} {format(createdAt + 'Z', 'HH:mm:ss.SSS')}

View File

@@ -211,14 +211,14 @@ export function GrpcConnectionSetupPane({
label: 'Refresh', label: 'Refresh',
type: 'default', type: 'default',
key: 'custom', key: 'custom',
leftSlot: <Icon className="text-fg-subtler" size="sm" icon="refresh" />, leftSlot: <Icon className="text-text-subtlest" size="sm" icon="refresh" />,
}, },
]} ]}
> >
<Button <Button
size="sm" size="sm"
variant="border" variant="border"
rightSlot={<Icon className="text-fg-subtler" size="sm" icon="chevronDown" />} rightSlot={<Icon className="text-text-subtlest" size="sm" icon="chevronDown" />}
disabled={isStreaming || services == null} disabled={isStreaming || services == null}
className={classNames( className={classNames(
'font-mono text-editor min-w-[5rem] !ring-0', 'font-mono text-editor min-w-[5rem] !ring-0',

View File

@@ -100,16 +100,16 @@ export function GrpcProtoSelection({ requestId }: Props) {
)} )}
{protoFiles.length > 0 && ( {protoFiles.length > 0 && (
<table className="w-full divide-y divide-background-highlight"> <table className="w-full divide-y divide-surface-highlight">
<thead> <thead>
<tr> <tr>
<th className="text-fg-subtler"> <th className="text-text-subtlest">
<span className="font-mono">*.proto</span> Files <span className="font-mono">*.proto</span> Files
</th> </th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-background-highlight"> <tbody className="divide-y divide-surface-highlight">
{protoFiles.map((f, i) => ( {protoFiles.map((f, i) => (
<tr key={f + i} className="group"> <tr key={f + i} className="group">
<td className="pl-1 font-mono">{f.split('/').pop()}</td> <td className="pl-1 font-mono">{f.split('/').pop()}</td>

View File

@@ -25,7 +25,7 @@ export function HeaderSize({
style={style} style={style}
className={classNames( className={classNames(
className, className,
'pt-[1px] w-full border-b border-background-highlight min-w-0', 'pt-[1px] w-full border-b border-border-subtle min-w-0',
stoplightsVisible ? 'pl-20 pr-1' : 'pl-1', stoplightsVisible ? 'pl-20 pr-1' : 'pl-1',
size === 'md' && 'h-[27px]', size === 'md' && 'h-[27px]',
size === 'lg' && 'h-[38px]', size === 'lg' && 'h-[38px]',

View File

@@ -20,7 +20,7 @@ export function ImportDataDialog({ importData }: Props) {
<li>Insomnia v4+</li> <li>Insomnia v4+</li>
<li>Swagger 2.0</li> <li>Swagger 2.0</li>
<li> <li>
Curl commands <em className="text-fg-subtle">(or paste into URL)</em> Curl commands <em className="text-text-subtle">(or paste into URL)</em>
</li> </li>
</ul> </ul>
</VStack> </VStack>

View File

@@ -44,7 +44,7 @@ export function Overlay({
onClick={onClose} onClick={onClose}
className={classNames( className={classNames(
'absolute inset-0', 'absolute inset-0',
variant === 'default' && 'bg-background-backdrop backdrop-blur-sm', variant === 'default' && 'bg-surface-backdrop backdrop-blur-sm',
)} )}
/> />

View File

@@ -86,8 +86,8 @@ export function RecentRequestsDropdown({ className }: Pick<ButtonProps, 'classNa
hotkeyAction="request_switcher.toggle" hotkeyAction="request_switcher.toggle"
className={classNames( className={classNames(
className, className,
'text-fg truncate pointer-events-auto', 'text truncate pointer-events-auto',
activeRequest === null && 'text-fg-subtler italic', activeRequest === null && 'text-text-subtlest italic',
)} )}
> >
{fallbackRequestName(activeRequest)} {fallbackRequestName(activeRequest)}

View File

@@ -1,8 +1,7 @@
import classNames from 'classnames'; import type { HttpResponse } from '@yaakapp/api';
import { useDeleteHttpResponse } from '../hooks/useDeleteHttpResponse'; import { useDeleteHttpResponse } from '../hooks/useDeleteHttpResponse';
import { useDeleteHttpResponses } from '../hooks/useDeleteHttpResponses'; import { useDeleteHttpResponses } from '../hooks/useDeleteHttpResponses';
import { useSaveResponse } from '../hooks/useSaveResponse'; import { useSaveResponse } from '../hooks/useSaveResponse';
import type { HttpResponse } from '@yaakapp/api';
import { pluralize } from '../lib/pluralize'; import { pluralize } from '../lib/pluralize';
import { Dropdown } from './core/Dropdown'; import { Dropdown } from './core/Dropdown';
import { Icon } from './core/Icon'; import { Icon } from './core/Icon';
@@ -21,7 +20,6 @@ export const RecentResponsesDropdown = function ResponsePane({
activeResponse, activeResponse,
responses, responses,
onPinnedResponseId, onPinnedResponseId,
className,
}: Props) { }: Props) {
const deleteResponse = useDeleteHttpResponse(activeResponse?.id ?? null); const deleteResponse = useDeleteHttpResponse(activeResponse?.id ?? null);
const deleteAllResponses = useDeleteHttpResponses(activeResponse?.requestId); const deleteAllResponses = useDeleteHttpResponses(activeResponse?.requestId);
@@ -68,7 +66,7 @@ export const RecentResponsesDropdown = function ResponsePane({
label: ( label: (
<HStack space={2}> <HStack space={2}>
<StatusTag className="text-sm" response={r} /> <StatusTag className="text-sm" response={r} />
<span className="text-fg-subtle">&rarr;</span>{' '} <span className="text-text-subtle">&rarr;</span>{' '}
<span className="font-mono text-sm">{r.elapsed >= 0 ? `${r.elapsed}ms` : 'n/a'}</span> <span className="font-mono text-sm">{r.elapsed >= 0 ? `${r.elapsed}ms` : 'n/a'}</span>
</HStack> </HStack>
), ),
@@ -80,7 +78,7 @@ export const RecentResponsesDropdown = function ResponsePane({
<IconButton <IconButton
title="Show response history" title="Show response history"
icon={activeResponse?.id === latestResponseId ? 'chevronDown' : 'pin'} icon={activeResponse?.id === latestResponseId ? 'chevronDown' : 'pin'}
className={classNames(className, 'm-0.5')} className="m-0.5"
size="sm" size="sm"
iconSize="md" iconSize="md"
/> />

View File

@@ -58,7 +58,7 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
return ( return (
<RadioDropdown value={method} items={radioItems} extraItems={extraItems} onChange={onChange}> <RadioDropdown value={method} items={radioItems} extraItems={extraItems} onChange={onChange}>
<Button size="xs" className={classNames(className, 'text-fg-subtle hover:text-fg')}> <Button size="xs" className={classNames(className, 'text-text-subtle hover:text')}>
{method.toUpperCase()} {method.toUpperCase()}
</Button> </Button>
</RadioDropdown> </RadioDropdown>

View File

@@ -83,7 +83,7 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ
className, className,
'x-theme-responsePane', 'x-theme-responsePane',
'max-h-full h-full', 'max-h-full h-full',
'bg-background rounded-md border border-background-highlight', 'bg-surface rounded-md border border-border-subtle',
'relative', 'relative',
)} )}
> >
@@ -99,7 +99,7 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ
<div className="h-full w-full grid grid-rows-[auto_minmax(0,1fr)] grid-cols-1"> <div className="h-full w-full grid grid-rows-[auto_minmax(0,1fr)] grid-cols-1">
<HStack <HStack
className={classNames( className={classNames(
'text-fg-subtle w-full flex-shrink-0', 'text-text-subtle w-full flex-shrink-0',
// Remove a bit of space because the tabs have lots too // Remove a bit of space because the tabs have lots too
'-mb-1.5', '-mb-1.5',
)} )}
@@ -177,7 +177,7 @@ export const ResponsePane = memo(function ResponsePane({ style, className, activ
// ) : viewMode === 'pretty' && contentType?.includes('json') ? ( // ) : viewMode === 'pretty' && contentType?.includes('json') ? (
// <JsonAttributeTree attrValue={activeResponse} /> // <JsonAttributeTree attrValue={activeResponse} />
<TextViewer <TextViewer
className="-mr-2" // Pull to the right className="-mr-2 bg-surface" // Pull to the right
response={activeResponse} response={activeResponse}
pretty={viewMode === 'pretty'} pretty={viewMode === 'pretty'}
/> />

View File

@@ -54,7 +54,7 @@ export function SelectFile({ onChange, filePath, inline, className }: Props) {
onClick={handleClear} onClick={handleClear}
/> />
)} )}
<div className="text-sm font-mono truncate rtl pr-3 text-fg"> <div className="text-sm font-mono truncate rtl pr-3 text">
{rtlEscapeChar} {rtlEscapeChar}
{filePath ?? 'No file selected'} {filePath ?? 'No file selected'}
</div> </div>

View File

@@ -32,7 +32,7 @@ export const Settings = () => {
data-tauri-drag-region data-tauri-drag-region
ignoreStoplights ignoreStoplights
size="md" size="md"
className="x-theme-appHeader bg-background text-fg-subtle flex items-center justify-center border-b border-background-highlight text-sm font-semibold" className="x-theme-appHeader bg-surface text-text-subtle flex items-center justify-center border-b border-border-subtle text-sm font-semibold"
> >
<HStack <HStack
space={2} space={2}

View File

@@ -159,11 +159,11 @@ export function SettingsAppearance() {
<VStack <VStack
space={3} space={3}
className="mt-3 w-full bg-background p-3 border border-dashed border-background-highlight rounded overflow-x-auto" className="mt-3 w-full bg-surface p-3 border border-dashed border-border-subtle rounded overflow-x-auto"
> >
<HStack className="text-fg font-bold" space={2}> <HStack className="text font-bold" space={2}>
Theme Preview{' '} Theme Preview{' '}
<Icon icon={appearance === 'dark' ? 'moon' : 'sun'} className="text-fg-subtle" /> <Icon icon={appearance === 'dark' ? 'moon' : 'sun'} className="text-text-subtle" />
</HStack> </HStack>
<HStack space={1.5} className="w-full"> <HStack space={1.5} className="w-full">
{buttonColors.map((c, i) => ( {buttonColors.map((c, i) => (
@@ -173,7 +173,7 @@ export function SettingsAppearance() {
size="2xs" size="2xs"
iconSize="xs" iconSize="xs"
icon={icons[i % icons.length]!} icon={icons[i % icons.length]!}
iconClassName="text-fg" iconClassName="text"
title={`${c}`} title={`${c}`}
/> />
))} ))}
@@ -185,7 +185,7 @@ export function SettingsAppearance() {
size="2xs" size="2xs"
iconSize="xs" iconSize="xs"
icon={icons[i % icons.length]!} icon={icons[i % icons.length]!}
iconClassName="text-fg" iconClassName="text"
title={`${c}`} title={`${c}`}
/> />
))} ))}

View File

@@ -81,7 +81,7 @@ export function SettingsGeneral() {
<Heading size={2}> <Heading size={2}>
Workspace{' '} Workspace{' '}
<div className="inline-block ml-1 bg-background-highlight px-2 py-0.5 rounded text-fg text-shrink"> <div className="inline-block ml-1 bg-surface-highlight px-2 py-0.5 rounded text text-shrink">
{workspace.name} {workspace.name}
</div> </div>
</Heading> </Heading>

View File

@@ -501,7 +501,7 @@ function SidebarItems({
aria-orientation="vertical" aria-orientation="vertical"
dir="ltr" dir="ltr"
className={classNames( className={classNames(
tree.depth > 0 && 'border-l border-background-highlight-secondary', tree.depth > 0 && 'border-l border-border-subtle',
tree.depth === 0 && 'ml-0', tree.depth === 0 && 'ml-0',
tree.depth >= 1 && 'ml-[1.2rem]', tree.depth >= 1 && 'ml-[1.2rem]',
)} )}
@@ -526,7 +526,7 @@ function SidebarItems({
(child.item.model === 'http_request' || child.item.model === 'grpc_request') && ( (child.item.model === 'http_request' || child.item.model === 'grpc_request') && (
<HttpMethodTag <HttpMethodTag
request={child.item} request={child.item}
className={classNames(!(active || selected) && 'text-fg-subtler')} className={classNames(!(active || selected) && 'text-text-subtlest')}
/> />
) )
} }
@@ -864,12 +864,12 @@ function SidebarItem({
data-active={isActive} data-active={isActive}
data-selected={selected} data-selected={selected}
className={classNames( className={classNames(
'w-full flex gap-1.5 items-center h-xs px-1.5 rounded-md', 'w-full flex gap-1.5 items-center h-xs px-1.5 rounded-md focus-visible:ring focus-visible:ring-border-focus outline-0',
editing && 'ring-1 focus-within:ring-focus', editing && 'ring-1 focus-within:ring-focus',
isActive && 'bg-background-highlight-secondary text-fg', isActive && 'bg-surface-highlight-secondary text',
!isActive && !isActive &&
'text-fg-subtle group-hover/item:text-fg active:bg-background-highlight-secondary', 'text-text-subtle group-hover/item:text-text active:bg-surface-highlight-secondary',
selected && useProminentStyles && '!bg-background-active', selected && useProminentStyles && '!bg-surface-active',
)} )}
> >
{itemModel === 'folder' && ( {itemModel === 'folder' && (
@@ -877,7 +877,7 @@ function SidebarItem({
size="sm" size="sm"
icon="chevronRight" icon="chevronRight"
className={classNames( className={classNames(
'text-fg-subtler', 'text-text-subtlest',
'transition-transform', 'transition-transform',
!isCollapsed(itemId) && 'transform rotate-90', !isCollapsed(itemId) && 'transform rotate-90',
)} )}
@@ -900,13 +900,13 @@ function SidebarItem({
{latestGrpcConnection ? ( {latestGrpcConnection ? (
<div className="ml-auto"> <div className="ml-auto">
{isResponseLoading(latestGrpcConnection) && ( {isResponseLoading(latestGrpcConnection) && (
<Icon spin size="sm" icon="update" className="text-fg-subtler" /> <Icon spin size="sm" icon="update" className="text-text-subtlest" />
)} )}
</div> </div>
) : latestHttpResponse ? ( ) : latestHttpResponse ? (
<div className="ml-auto"> <div className="ml-auto">
{isResponseLoading(latestHttpResponse) ? ( {isResponseLoading(latestHttpResponse) ? (
<Icon spin size="sm" icon="refresh" className="text-fg-subtler" /> <Icon spin size="sm" icon="refresh" className="text-text-subtlest" />
) : ( ) : (
<StatusTag className="text-xs" response={latestHttpResponse} /> <StatusTag className="text-xs" response={latestHttpResponse} />
)} )}

View File

@@ -76,7 +76,6 @@ export const UrlBar = memo(function UrlBar({
onFocus={() => setIsFocused(true)} onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)} onBlur={() => setIsFocused(false)}
onPaste={onPaste} onPaste={onPaste}
containerClassName="bg-background border border-background-highlight"
onChange={onUrlChange} onChange={onUrlChange}
defaultValue={url} defaultValue={url}
placeholder={placeholder} placeholder={placeholder}

View File

@@ -23,7 +23,7 @@ export function WindowControls({ className, onlyX }: Props) {
{!onlyX && ( {!onlyX && (
<> <>
<Button <Button
className="!h-full px-4 text-fg-subtle hocus:text-fg hocus:bg-background-highlight-secondary rounded-none" className="!h-full px-4 text-text-subtle hocus:text hocus:bg-surface-highlight-secondary rounded-none"
color="custom" color="custom"
onClick={() => getCurrentWebviewWindow().minimize()} onClick={() => getCurrentWebviewWindow().minimize()}
> >
@@ -32,7 +32,7 @@ export function WindowControls({ className, onlyX }: Props) {
</svg> </svg>
</Button> </Button>
<Button <Button
className="!h-full px-4 text-fg-subtle hocus:text-fg hocus:bg-background-highlight rounded-none" className="!h-full px-4 text-text-subtle hocus:text hocus:bg-surface-highlight rounded-none"
color="custom" color="custom"
onClick={async () => { onClick={async () => {
const w = getCurrentWebviewWindow(); const w = getCurrentWebviewWindow();
@@ -57,7 +57,7 @@ export function WindowControls({ className, onlyX }: Props) {
)} )}
<Button <Button
color="custom" color="custom"
className="!h-full px-4 text-fg-subtle rounded-none hocus:bg-fg-danger hocus:text-fg" className="!h-full px-4 text-text-subtle rounded-none hocus:bg-fg-danger hocus:text"
onClick={() => getCurrentWebviewWindow().close()} onClick={() => getCurrentWebviewWindow().close()}
> >
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">

View File

@@ -140,7 +140,7 @@ export default function Workspace() {
animate={{ opacity: 1, x: 0 }} animate={{ opacity: 1, x: 0 }}
className={classNames( className={classNames(
'x-theme-sidebar', 'x-theme-sidebar',
'absolute top-0 left-0 bottom-0 bg-background border-r border-background-highlight w-[14rem]', 'absolute top-0 left-0 bottom-0 bg-surface border-r border-border-subtle w-[14rem]',
'grid grid-rows-[auto_1fr]', 'grid grid-rows-[auto_1fr]',
)} )}
> >
@@ -152,11 +152,8 @@ export default function Workspace() {
</Overlay> </Overlay>
) : ( ) : (
<> <>
<div <div style={side} className={classNames('x-theme-sidebar', 'overflow-hidden bg-surface')}>
style={side} <Sidebar className="border-r border-border-subtle" />
className={classNames('x-theme-sidebar', 'overflow-hidden bg-background')}
>
<Sidebar className="border-r border-background-highlight" />
</div> </div>
<ResizeHandle <ResizeHandle
className="-translate-x-3" className="-translate-x-3"
@@ -171,7 +168,7 @@ export default function Workspace() {
<HeaderSize <HeaderSize
data-tauri-drag-region data-tauri-drag-region
size="lg" size="lg"
className="x-theme-appHeader bg-background" className="x-theme-appHeader bg-surface"
style={head} style={head}
> >
<WorkspaceHeader className="pointer-events-none" /> <WorkspaceHeader className="pointer-events-none" />
@@ -180,7 +177,7 @@ export default function Workspace() {
<div className="m-auto"> <div className="m-auto">
<Banner color="warning" className="max-w-[30rem]"> <Banner color="warning" className="max-w-[30rem]">
The active workspace{' '} The active workspace{' '}
<InlineCode className="text-fg-warning">{activeWorkspaceId}</InlineCode> was not found. <InlineCode className="text-warning">{activeWorkspaceId}</InlineCode> was not found.
Select a workspace from the header menu or report this bug to <FeedbackLink /> Select a workspace from the header menu or report this bug to <FeedbackLink />
</Banner> </Banner>
</div> </div>

View File

@@ -130,7 +130,7 @@ export const WorkspaceActionsDropdown = memo(function WorkspaceActionsDropdown({
size="sm" size="sm"
className={classNames( className={classNames(
className, className,
'text-fg !px-2 truncate', 'text !px-2 truncate',
activeWorkspace === null && 'italic opacity-disabled', activeWorkspace === null && 'italic opacity-disabled',
)} )}
{...buttonProps} {...buttonProps}

View File

@@ -26,7 +26,7 @@ export const WorkspaceHeader = memo(function WorkspaceHeader({ className }: Prop
<CookieDropdown /> <CookieDropdown />
<HStack> <HStack>
<WorkspaceActionsDropdown /> <WorkspaceActionsDropdown />
<Icon icon="chevronRight" className="text-fg-subtle" /> <Icon icon="chevronRight" className="text-text-subtle" />
<EnvironmentActionsDropdown className="w-auto pointer-events-auto" /> <EnvironmentActionsDropdown className="w-auto pointer-events-auto" />
</HStack> </HStack>
</HStack> </HStack>

View File

@@ -15,7 +15,7 @@ export function Banner({ children, className, color = 'secondary' }: Props) {
className, className,
`x-theme-banner--${color}`, `x-theme-banner--${color}`,
'border border-dashed italic px-3 py-2 rounded select-auto cursor-text', 'border border-dashed italic px-3 py-2 rounded select-auto cursor-text',
'border-background-highlight bg-background-highlight-secondary text-fg', 'border-border-subtle bg-surface-highlight text',
)} )}
> >
{children} {children}

View File

@@ -60,7 +60,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button
'x-theme-button', 'x-theme-button',
`x-theme-button--${variant}`, `x-theme-button--${variant}`,
`x-theme-button--${variant}--${color}`, `x-theme-button--${variant}--${color}`,
'text-fg', 'text-text',
'border', // They all have borders to ensure the same width 'border', // They all have borders to ensure the same width
'max-w-full min-w-0', // Help with truncation 'max-w-full min-w-0', // Help with truncation
'hocus:opacity-100', // Force opacity for certain hover effects 'hocus:opacity-100', // Force opacity for certain hover effects
@@ -77,24 +77,18 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button
// Solids // Solids
variant === 'solid' && 'border-transparent', variant === 'solid' && 'border-transparent',
variant === 'solid' && color === 'custom' && 'ring-blue-400', variant === 'solid' && color === 'custom' && 'ring-border-focus',
variant === 'solid' && variant === 'solid' &&
color !== 'custom' && color !== 'custom' &&
color !== 'default' && 'enabled:hocus:text-text enabled:hocus:bg-surface-highlight ring-border-subtle',
'bg-background enabled:hocus:bg-background-highlight ring-background-highlight-secondary', variant === 'solid' && color !== 'custom' && color !== 'default' && 'bg-surface',
variant === 'solid' &&
color === 'default' &&
'enabled:hocus:bg-background-highlight ring-fg-info',
// Borders // Borders
variant === 'border' && 'border', variant === 'border' && 'border',
variant === 'border' && variant === 'border' &&
color !== 'custom' && color !== 'custom' &&
color !== 'default' && 'border-border-subtle text-text-subtle enabled:hocus:border-border ' +
'border-fg-subtler text-fg-subtle enabled:hocus:border-fg-subtle enabled:hocus:bg-background-highlight enabled:hocus:text-fg ring-fg-subtler', 'enabled:hocus:bg-surface-highlight enabled:hocus:text-text ring-border-subtler',
variant === 'border' &&
color === 'default' &&
'border-background-highlight enabled:hocus:border-fg-subtler enabled:hocus:bg-background-highlight-secondary',
); );
const buttonRef = useRef<HTMLButtonElement>(null); const buttonRef = useRef<HTMLButtonElement>(null);

View File

@@ -27,13 +27,13 @@ export function Checkbox({
<HStack <HStack
as="label" as="label"
space={2} space={2}
className={classNames(className, 'text-fg', disabled && 'opacity-disabled')} className={classNames(className, 'text-text mr-auto', disabled && 'opacity-disabled')}
> >
<div className={classNames(inputWrapperClassName, 'x-theme-input', 'relative flex')}> <div className={classNames(inputWrapperClassName, 'x-theme-input', 'relative flex')}>
<input <input
aria-hidden aria-hidden
className={classNames( className={classNames(
'appearance-none w-4 h-4 flex-shrink-0 border border-background-highlight', 'appearance-none w-4 h-4 flex-shrink-0 border border-border',
'rounded hocus:border-border-focus hocus:bg-focus/[5%] outline-none ring-0', 'rounded hocus:border-border-focus hocus:bg-focus/[5%] outline-none ring-0',
)} )}
type="checkbox" type="checkbox"

View File

@@ -12,7 +12,7 @@ export function CountBadge({ count, className }: Props) {
aria-hidden aria-hidden
className={classNames( className={classNames(
className, className,
'opacity-70 border border-background-highlight-secondary text-4xs rounded mb-0.5 px-1 ml-1 h-4 font-mono', 'opacity-70 border border-border-subtle text-4xs rounded mb-0.5 px-1 ml-1 h-4 font-mono',
)} )}
> >
{count} {count}

View File

@@ -67,9 +67,9 @@ export function Dialog({
className, className,
'grid grid-rows-[auto_auto_minmax(0,1fr)]', 'grid grid-rows-[auto_auto_minmax(0,1fr)]',
'grid-cols-1', // must be here for inline code blocks to correctly break words 'grid-cols-1', // must be here for inline code blocks to correctly break words
'relative bg-background pointer-events-auto', 'relative bg-surface pointer-events-auto',
'rounded-lg', 'rounded-lg',
'border border-background-highlight-secondary shadow-lg shadow-[rgba(0,0,0,0.1)]', 'border border-border-subtle shadow-lg shadow-[rgba(0,0,0,0.1)]',
'max-w-[calc(100vw-5rem)] max-h-[calc(100vh-4rem)]', 'max-w-[calc(100vw-5rem)] max-h-[calc(100vh-4rem)]',
size === 'sm' && 'w-[28rem] max-h-[80vh]', size === 'sm' && 'w-[28rem] max-h-[80vh]',
size === 'md' && 'w-[45rem] max-h-[80vh]', size === 'md' && 'w-[45rem] max-h-[80vh]',
@@ -87,7 +87,7 @@ export function Dialog({
)} )}
{description ? ( {description ? (
<p className="px-6 text-fg-subtle" id={descriptionId}> <p className="px-6 text-text-subtle" id={descriptionId}>
{description} {description}
</p> </p>
) : ( ) : (

View File

@@ -433,7 +433,7 @@ const Menu = forwardRef<Omit<DropdownRef, 'open' | 'isOpen' | 'toggle'>, MenuPro
<span <span
aria-hidden aria-hidden
style={triangleStyles} style={triangleStyles}
className="bg-background absolute rotate-45 border-background-highlight-secondary border-t border-l" className="bg-surface absolute rotate-45 border-border-subtle border-t border-l"
/> />
)} )}
{containerStyles && ( {containerStyles && (
@@ -442,21 +442,21 @@ const Menu = forwardRef<Omit<DropdownRef, 'open' | 'isOpen' | 'toggle'>, MenuPro
style={menuStyles} style={menuStyles}
className={classNames( className={classNames(
className, className,
'h-auto bg-background rounded-md shadow-lg py-1.5 border', 'h-auto bg-surface rounded-md shadow-lg py-1.5 border',
'border-background-highlight-secondary overflow-auto mb-1 mx-0.5', 'border-border-subtle overflow-auto mb-1 mx-0.5',
)} )}
> >
{filter && ( {filter && (
<HStack <HStack
space={2} space={2}
className="pb-0.5 px-1.5 mb-2 text-sm border border-background-highlight-secondary mx-2 rounded font-mono h-xs" className="pb-0.5 px-1.5 mb-2 text-sm border border-border-subtle mx-2 rounded font-mono h-xs"
> >
<Icon icon="search" size="xs" className="text-fg-subtle" /> <Icon icon="search" size="xs" className="text-text-subtle" />
<div className="text-fg">{filter}</div> <div className="text">{filter}</div>
</HStack> </HStack>
)} )}
{filteredItems.length === 0 && ( {filteredItems.length === 0 && (
<span className="text-fg-subtler text-center px-2 py-1">No matches</span> <span className="text-text-subtlest text-center px-2 py-1">No matches</span>
)} )}
{filteredItems.map((item, i) => { {filteredItems.map((item, i) => {
if (item.hidden) { if (item.hidden) {
@@ -540,9 +540,9 @@ function MenuItem({ className, focused, onFocus, item, onSelect, ...props }: Men
className, className,
'h-xs', // More compact 'h-xs', // More compact
'min-w-[8rem] outline-none px-2 mx-1.5 flex whitespace-nowrap', 'min-w-[8rem] outline-none px-2 mx-1.5 flex whitespace-nowrap',
'focus:bg-background-highlight focus:text-fg rounded', 'focus:bg-surface-highlight focus:text rounded',
item.variant === 'danger' && '!text-fg-danger', item.variant === 'danger' && '!text-danger',
item.variant === 'notify' && '!text-fg-primary', item.variant === 'notify' && '!text-primary',
)} )}
{...props} {...props}
> >

View File

@@ -5,7 +5,7 @@
@apply w-full block text-base; @apply w-full block text-base;
.cm-cursor { .cm-cursor {
@apply border-fg !important; @apply border-text !important;
/* Widen the cursor */ /* Widen the cursor */
@apply border-l-[2px]; @apply border-l-[2px];
} }
@@ -20,11 +20,11 @@
.cm-line { .cm-line {
@apply w-full; /* Important! Ensure it spans the entire width */ @apply w-full; /* Important! Ensure it spans the entire width */
@apply w-full text-fg pl-1 pr-1.5; @apply w-full text-text pl-1 pr-1.5;
} }
.cm-placeholder { .cm-placeholder {
@apply text-placeholder; @apply text-text-subtlest;
} }
.cm-scroller { .cm-scroller {
@@ -50,7 +50,10 @@
/* Style gutters */ /* Style gutters */
.cm-gutters { .cm-gutters {
@apply border-0 text-fg-subtler bg-transparent; @apply border-0 text-text-subtlest bg-surface;
/* Not sure why, but there's a tiny gap left of the gutter that you can see text
through. Move left slightly to fix that. */
@apply -left-[1px];
.cm-gutterElement { .cm-gutterElement {
@apply cursor-default; @apply cursor-default;
@@ -59,8 +62,8 @@
.placeholder { .placeholder {
/* Colors */ /* Colors */
@apply bg-background text-fg-subtle border-background-highlight-secondary; @apply bg-surface text-text-subtle border-border-subtle;
@apply hover:border-background-highlight hover:text-fg hover:bg-background-highlight-secondary; @apply hover:border-border-subtle hover:text-text hover:bg-surface-highlight;
@apply border px-1 mx-[0.5px] rounded cursor-default dark:shadow; @apply border px-1 mx-[0.5px] rounded cursor-default dark:shadow;
@@ -147,12 +150,12 @@
} }
.cm-editor .fold-gutter-icon:hover { .cm-editor .fold-gutter-icon:hover {
@apply text-fg bg-background-highlight; @apply text-text bg-surface-highlight;
} }
.cm-editor .cm-foldPlaceholder { .cm-editor .cm-foldPlaceholder {
@apply px-2 border border-fg-subtler bg-background-highlight; @apply px-2 border border-border-subtle bg-surface-highlight;
@apply hover:text-fg hover:border-fg-subtle text-fg; @apply hover:text-text hover:border-border-subtle text-text;
@apply cursor-default !important; @apply cursor-default !important;
} }
@@ -162,13 +165,13 @@
.cm-wrapper:not(.cm-readonly) .cm-editor { .cm-wrapper:not(.cm-readonly) .cm-editor {
&.cm-focused .cm-activeLineGutter { &.cm-focused .cm-activeLineGutter {
@apply text-fg-subtle; @apply text-text-subtle;
} }
} }
.cm-wrapper.cm-readonly .cm-editor { .cm-wrapper.cm-readonly .cm-editor {
.cm-cursor { .cm-cursor {
@apply border-fg-danger !important; @apply border-danger !important;
} }
} }
@@ -187,18 +190,18 @@
} }
.cm-tooltip.cm-tooltip-hover { .cm-tooltip.cm-tooltip-hover {
@apply shadow-lg bg-background rounded text-fg-subtle border border-fg-subtler z-50 pointer-events-auto text-sm; @apply shadow-lg bg-surface rounded text-text-subtle border border-border-subtle z-50 pointer-events-auto text-sm;
@apply px-2 py-1; @apply px-2 py-1;
a { a {
@apply text-fg; @apply text-text;
&:hover { &:hover {
@apply underline; @apply underline;
} }
&::after { &::after {
@apply text-fg bg-fg-secondary h-3 w-3 ml-1; @apply text-text bg-surface-highlight h-3 w-3 ml-1;
content: ''; content: '';
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='black' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E"); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='black' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z'/%3E%3Cpath fill-rule='evenodd' d='M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z'/%3E%3C/svg%3E");
-webkit-mask-size: contain; -webkit-mask-size: contain;
@@ -210,7 +213,7 @@
/* NOTE: Extra selector required to override default styles */ /* NOTE: Extra selector required to override default styles */
.cm-tooltip.cm-tooltip-autocomplete, .cm-tooltip.cm-tooltip-autocomplete,
.cm-tooltip.cm-completionInfo { .cm-tooltip.cm-completionInfo {
@apply shadow-lg bg-background rounded text-fg-subtle border border-background-highlight z-50 pointer-events-auto text-editor; @apply shadow-lg bg-surface rounded text-text-subtle border border-border-subtle z-50 pointer-events-auto text-editor;
.cm-completionIcon { .cm-completionIcon {
@apply italic font-mono; @apply italic font-mono;
@@ -288,11 +291,11 @@
} }
& > ul > li { & > ul > li {
@apply cursor-default px-2 h-[2em] rounded-sm text-fg flex items-center; @apply cursor-default px-2 h-[2em] rounded-sm text-text flex items-center;
} }
& > ul > li[aria-selected] { & > ul > li[aria-selected] {
@apply bg-background-highlight-secondary text-fg; @apply bg-surface-highlight text-text;
} }
.cm-completionIcon { .cm-completionIcon {
@@ -300,17 +303,17 @@
} }
.cm-completionLabel { .cm-completionLabel {
@apply text-fg; @apply text-text;
} }
.cm-completionDetail { .cm-completionDetail {
@apply ml-auto pl-6 text-fg-subtle; @apply ml-auto pl-6 text-text-subtle;
} }
} }
} }
.cm-editor .cm-panels { .cm-editor .cm-panels {
@apply bg-background-highlight-secondary backdrop-blur-sm p-1 mb-1 text-fg z-20 rounded-md; @apply bg-surface-highlight backdrop-blur-sm p-1 mb-1 text-text z-20 rounded-md;
input, input,
button { button {
@@ -318,21 +321,21 @@
} }
button { button {
@apply border-fg-subtler bg-background-highlight text-fg hover:border-fg-info; @apply border-border-subtle bg-surface-highlight text-text hover:border-info;
@apply appearance-none bg-none cursor-default; @apply appearance-none bg-none cursor-default;
} }
button[name='close'] { button[name='close'] {
@apply text-fg-subtle hocus:text-fg px-2 -mr-1.5 !important; @apply text-text-subtle hocus:text-text px-2 -mr-1.5 !important;
} }
input { input {
@apply bg-background border-background-highlight focus:border-border-focus; @apply bg-surface border-border-subtle focus:border-border-focus;
@apply border outline-none cursor-text; @apply border outline-none cursor-text;
} }
label { label {
@apply focus-within:text-fg; @apply focus-within:text-text;
} }
/* Hide the "All" button */ /* Hide the "All" button */

View File

@@ -162,12 +162,6 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
view.dispatch({ effects: languageCompartment.reconfigure(ext) }); view.dispatch({ effects: languageCompartment.reconfigure(ext) });
}, [contentType, autocomplete, useTemplating, environment, workspace]); }, [contentType, autocomplete, useTemplating, environment, workspace]);
const classList = className?.split(/\s+/) ?? [];
const bgClassList = classList
.filter((c) => c.match(/(^|:)?bg-.+/)) // Find bg-* classes
.map((c) => c.replace(/^bg-/, '!bg-')) // !important
.map((c) => c.replace(/^dark:bg-/, 'dark:!bg-')); // !important
// Initialize the editor when ref mounts // Initialize the editor when ref mounts
const initEditorRef = useCallback( const initEditorRef = useCallback(
(container: HTMLDivElement | null) => { (container: HTMLDivElement | null) => {
@@ -230,8 +224,7 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
const decoratedActions = useMemo(() => { const decoratedActions = useMemo(() => {
const results = []; const results = [];
const actionClassName = classNames( const actionClassName = classNames(
'transition-opacity opacity-0 group-hover:opacity-80 hover:!opacity-100 shadow', 'bg-surface transition-opacity opacity-0 group-hover:opacity-100 hover:!opacity-100 shadow',
bgClassList,
); );
if (format) { if (format) {
@@ -269,7 +262,7 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
}), }),
); );
return results; return results;
}, [actions, bgClassList, format, onChange]); }, [actions, format, onChange]);
const cmContainer = ( const cmContainer = (
<div <div
@@ -290,7 +283,7 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
} }
return ( return (
<div className="group relative h-full w-full x-theme-editor bg-background"> <div className="group relative h-full w-full x-theme-editor bg-surface">
{cmContainer} {cmContainer}
{decoratedActions && ( {decoratedActions && (
<HStack <HStack

View File

@@ -43,23 +43,23 @@ import { url } from './url/extension';
export const syntaxHighlightStyle = HighlightStyle.define([ export const syntaxHighlightStyle = HighlightStyle.define([
{ {
tag: [t.documentMeta, t.blockComment, t.lineComment, t.docComment, t.comment], tag: [t.documentMeta, t.blockComment, t.lineComment, t.docComment, t.comment],
color: 'var(--fg-subtler)', color: 'var(--textSubtlest)',
fontStyle: 'italic', fontStyle: 'italic',
}, },
{ {
tag: [t.paren, t.bracket, t.brace], tag: [t.paren, t.bracket, t.brace],
color: 'var(--fg)', color: 'var(--textSubtle)',
}, },
{ {
tag: [t.link, t.name, t.tagName, t.angleBracket, t.docString, t.number], tag: [t.link, t.name, t.tagName, t.angleBracket, t.docString, t.number],
color: 'var(--fg-info)', color: 'var(--info)',
}, },
{ tag: [t.variableName], color: 'var(--fg-success)' }, { tag: [t.variableName], color: 'var(--success)' },
{ tag: [t.bool], color: 'var(--fg-warning)' }, { tag: [t.bool], color: 'var(--warning)' },
{ tag: [t.attributeName, t.propertyName], color: 'var(--fg-primary)' }, { tag: [t.attributeName, t.propertyName], color: 'var(--primary)' },
{ tag: [t.attributeValue], color: 'var(--fg-warning)' }, { tag: [t.attributeValue], color: 'var(--warning)' },
{ tag: [t.string], color: 'var(--fg-notice)' }, { tag: [t.string], color: 'var(--notice)' },
{ tag: [t.atom, t.meta, t.operator, t.bool, t.null, t.keyword], color: 'var(--fg-danger)' }, { tag: [t.atom, t.meta, t.operator, t.bool, t.null, t.keyword], color: 'var(--danger)' },
]); ]);
const syntaxTheme = EditorView.theme({}, { dark: true }); const syntaxTheme = EditorView.theme({}, { dark: true });

View File

@@ -9,8 +9,8 @@ export function FormattedError({ children }: Props) {
return ( return (
<pre <pre
className={classNames( className={classNames(
'font-mono text-sm w-full select-auto cursor-text bg-background-highlight-secondary p-3 rounded', 'font-mono text-sm w-full select-auto cursor-text bg-surface-highlight-secondary p-3 rounded',
'whitespace-pre-wrap border border-fg-danger border-dashed overflow-x-auto', 'whitespace-pre-wrap border border-danger border-dashed overflow-x-auto',
)} )}
> >
{children} {children}

View File

@@ -11,7 +11,7 @@ export function Heading({ className, size = 1, ...props }: Props) {
<Component <Component
className={classNames( className={classNames(
className, className,
'font-semibold text-fg', 'font-semibold text',
size === 1 && 'text-2xl', size === 1 && 'text-2xl',
size === 2 && 'text-xl', size === 2 && 'text-xl',
size === 3 && 'text-lg', size === 3 && 'text-lg',

View File

@@ -22,7 +22,7 @@ export function HotKey({ action, className, variant }: Props) {
className={classNames( className={classNames(
className, className,
variant === 'with-bg' && 'rounded border', variant === 'with-bg' && 'rounded border',
'text-fg-subtler', 'text-text-subtlest',
)} )}
> >
{labelParts.map((char, index) => ( {labelParts.map((char, index) => (

View File

@@ -9,5 +9,7 @@ interface Props {
export function HotKeyLabel({ action, className }: Props) { export function HotKeyLabel({ action, className }: Props) {
const label = useHotKeyLabel(action); const label = useHotKeyLabel(action);
return <span className={classNames(className, 'text-fg-subtle whitespace-nowrap')}>{label}</span>; return (
<span className={classNames(className, 'text-text-subtle whitespace-nowrap')}>{label}</span>
);
} }

View File

@@ -43,7 +43,7 @@ export function HttpMethodTag({ shortNames, request, className }: Props) {
<span <span
className={classNames( className={classNames(
className, className,
'text-xs font-mono text-fg-subtle', 'text-xs font-mono text-text-subtle',
'pt-[0.25em]', // Fix for monospace font not vertically centering 'pt-[0.25em]', // Fix for monospace font not vertically centering
shortNames && 'w-[2.5em]', shortNames && 'w-[2.5em]',
)} )}

View File

@@ -20,6 +20,7 @@ export const IconButton = forwardRef<HTMLButtonElement, Props>(function IconButt
{ {
showConfirm, showConfirm,
icon, icon,
color = 'default',
spin, spin,
onClick, onClick,
className, className,
@@ -50,10 +51,13 @@ export const IconButton = forwardRef<HTMLButtonElement, Props>(function IconButt
onClick={handleClick} onClick={handleClick}
innerClassName="flex items-center justify-center" innerClassName="flex items-center justify-center"
size={size} size={size}
color={color}
className={classNames( className={classNames(
className, className,
'group/button relative flex-shrink-0 text-fg-subtle', 'group/button relative flex-shrink-0',
'!px-0', '!px-0',
color === 'custom' && 'text-text-subtle',
color === 'default' && 'text-text-subtle',
size === 'md' && 'w-9', size === 'md' && 'w-9',
size === 'sm' && 'w-8', size === 'sm' && 'w-8',
size === 'xs' && 'w-6', size === 'xs' && 'w-6',
@@ -72,7 +76,7 @@ export const IconButton = forwardRef<HTMLButtonElement, Props>(function IconButt
spin={spin} spin={spin}
className={classNames( className={classNames(
iconClassName, iconClassName,
'group-hover/button:text-fg', 'group-hover/button:text',
props.disabled && 'opacity-70', props.disabled && 'opacity-70',
confirmed && 'text-green-600', confirmed && 'text-green-600',
)} )}

View File

@@ -6,8 +6,8 @@ export function InlineCode({ className, ...props }: HTMLAttributes<HTMLSpanEleme
<code <code
className={classNames( className={classNames(
className, className,
'font-mono text-shrink bg-background-highlight-secondary border border-background-highlight-secondary', 'font-mono text-shrink bg-surface-highlight-secondary border border-border-subtle',
'px-1.5 py-0.5 rounded text-fg shadow-inner break-words', 'px-1.5 py-0.5 rounded text shadow-inner break-words',
)} )}
{...props} {...props}
/> />

View File

@@ -136,7 +136,7 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
htmlFor={id} htmlFor={id}
className={classNames( className={classNames(
labelClassName, labelClassName,
'text-fg-subtle whitespace-nowrap', 'text-text-subtle whitespace-nowrap',
hideLabel && 'sr-only', hideLabel && 'sr-only',
)} )}
> >
@@ -147,10 +147,10 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
className={classNames( className={classNames(
containerClassName, containerClassName,
'x-theme-input', 'x-theme-input',
'relative w-full rounded-md text-fg', 'relative w-full rounded-md text',
'border', 'border',
focused ? 'border-border-focus' : 'border-background-highlight', focused ? 'border-border-focus' : 'border-border',
!isValid && '!border-fg-danger', !isValid && '!border-danger',
size === 'md' && 'min-h-md', size === 'md' && 'min-h-md',
size === 'sm' && 'min-h-sm', size === 'sm' && 'min-h-sm',
size === 'xs' && 'min-h-xs', size === 'xs' && 'min-h-xs',
@@ -187,7 +187,7 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
title={obscured ? `Show ${label}` : `Obscure ${label}`} title={obscured ? `Show ${label}` : `Obscure ${label}`}
size="xs" size="xs"
className="mr-0.5 group/obscure !h-auto my-0.5" className="mr-0.5 group/obscure !h-auto my-0.5"
iconClassName="text-fg-subtle group-hover/obscure:text-fg" iconClassName="text-text-subtle group-hover/obscure:text"
iconSize="sm" iconSize="sm"
icon={obscured ? 'eye' : 'eyeClosed'} icon={obscured ? 'eye' : 'eyeClosed'}
onClick={() => setObscured((o) => !o)} onClick={() => setObscured((o) => !o)}

View File

@@ -48,7 +48,7 @@ export const JsonAttributeTree = ({
: null, : null,
isExpandable: Object.keys(attrValue).length > 0, isExpandable: Object.keys(attrValue).length > 0,
label: isExpanded ? `{${Object.keys(attrValue).length || ' '}}` : `{⋯}`, label: isExpanded ? `{${Object.keys(attrValue).length || ' '}}` : `{⋯}`,
labelClassName: 'text-fg-subtler', labelClassName: 'text-text-subtlest',
}; };
} else if (jsonType === '[object Array]') { } else if (jsonType === '[object Array]') {
return { return {
@@ -66,7 +66,7 @@ export const JsonAttributeTree = ({
: null, : null,
isExpandable: attrValue.length > 0, isExpandable: attrValue.length > 0,
label: isExpanded ? `[${attrValue.length || ' '}]` : `[⋯]`, label: isExpanded ? `[${attrValue.length || ' '}]` : `[⋯]`,
labelClassName: 'text-fg-subtler', labelClassName: 'text-text-subtlest',
}; };
} else { } else {
return { return {
@@ -74,17 +74,17 @@ export const JsonAttributeTree = ({
isExpandable: false, isExpandable: false,
label: jsonType === '[object String]' ? `"${attrValue}"` : `${attrValue}`, label: jsonType === '[object String]' ? `"${attrValue}"` : `${attrValue}`,
labelClassName: classNames( labelClassName: classNames(
jsonType === '[object Boolean]' && 'text-fg-primary', jsonType === '[object Boolean]' && 'text-primary',
jsonType === '[object Number]' && 'text-fg-info', jsonType === '[object Number]' && 'text-info',
jsonType === '[object String]' && 'text-fg-notice', jsonType === '[object String]' && 'text-notice',
jsonType === '[object Null]' && 'text-fg-danger', jsonType === '[object Null]' && 'text-danger',
), ),
}; };
} }
}, [attrValue, attrKeyJsonPath, isExpanded, depth]); }, [attrValue, attrKeyJsonPath, isExpanded, depth]);
const labelEl = ( const labelEl = (
<span className={classNames(labelClassName, 'select-text group-hover:text-fg-subtle')}> <span className={classNames(labelClassName, 'select-text group-hover:text-text-subtle')}>
{label} {label}
</span> </span>
); );
@@ -104,18 +104,18 @@ export const JsonAttributeTree = ({
icon="chevronRight" icon="chevronRight"
className={classNames( className={classNames(
'left-0 absolute transition-transform flex items-center', 'left-0 absolute transition-transform flex items-center',
'text-fg-subtler group-hover:text-fg-subtle', 'text-text-subtlest group-hover:text-text-subtle',
isExpanded ? 'rotate-90' : '', isExpanded ? 'rotate-90' : '',
)} )}
/> />
<span className="text-fg-primary group-hover:text-fg-primary mr-1.5 whitespace-nowrap"> <span className="text-primary group-hover:text-primary mr-1.5 whitespace-nowrap">
{attrKey === undefined ? '$' : attrKey}: {attrKey === undefined ? '$' : attrKey}:
</span> </span>
{labelEl} {labelEl}
</button> </button>
) : ( ) : (
<> <>
<span className="text-fg-primary mr-1.5 pl-4 whitespace-nowrap select-text"> <span className="text-primary mr-1.5 pl-4 whitespace-nowrap select-text">
{attrKey}: {attrKey}:
</span> </span>
{labelEl} {labelEl}

View File

@@ -34,9 +34,9 @@ export function KeyValueRow({ label, value, labelColor = 'secondary', labelClass
className={classNames( className={classNames(
'py-0.5 pr-2 select-text cursor-text', 'py-0.5 pr-2 select-text cursor-text',
labelClassName, labelClassName,
labelColor === 'primary' && 'text-fg-primary', labelColor === 'primary' && 'text-primary',
labelColor === 'secondary' && 'text-fg-subtle', labelColor === 'secondary' && 'text-text-subtle',
labelColor === 'info' && 'text-fg-info', labelColor === 'info' && 'text-info',
)} )}
> >
{label} {label}

View File

@@ -360,7 +360,7 @@ function PairEditorRow({
title={pairContainer.pair.enabled ? 'Disable item' : 'Enable item'} title={pairContainer.pair.enabled ? 'Disable item' : 'Enable item'}
disabled={isLast} disabled={isLast}
checked={isLast ? false : !!pairContainer.pair.enabled} checked={isLast ? false : !!pairContainer.pair.enabled}
className={classNames('mr-2', isLast && '!opacity-disabled')} className={classNames('pr-2', isLast && '!opacity-disabled')}
onChange={handleChangeEnabled} onChange={handleChangeEnabled}
/> />
<div <div

View File

@@ -26,7 +26,7 @@ export function PairOrBulkEditor({ preferenceName, ...props }: Props) {
title={useBulk ? 'Enable form edit' : 'Enable bulk edit'} title={useBulk ? 'Enable form edit' : 'Enable bulk edit'}
className={classNames( className={classNames(
'transition-opacity opacity-0 group-hover:opacity-80 hover:!opacity-100 shadow', 'transition-opacity opacity-0 group-hover:opacity-80 hover:!opacity-100 shadow',
'bg-background text-fg-subtle hover:text-fg group-hover/wrapper:opacity-100', 'bg-surface text-text-subtle hover:text group-hover/wrapper:opacity-100',
)} )}
onClick={() => setUseBulk((b) => !b)} onClick={() => setUseBulk((b) => !b)}
icon={useBulk ? 'table' : 'fileCode'} icon={useBulk ? 'table' : 'fileCode'}

View File

@@ -88,7 +88,7 @@ export const PlainInput = forwardRef<HTMLInputElement, PlainInputProps>(function
htmlFor={id} htmlFor={id}
className={classNames( className={classNames(
labelClassName, labelClassName,
'text-fg-subtle whitespace-nowrap', 'text-text-subtle whitespace-nowrap',
hideLabel && 'sr-only', hideLabel && 'sr-only',
)} )}
> >
@@ -99,10 +99,10 @@ export const PlainInput = forwardRef<HTMLInputElement, PlainInputProps>(function
className={classNames( className={classNames(
containerClassName, containerClassName,
'x-theme-input', 'x-theme-input',
'relative w-full rounded-md text-fg', 'relative w-full rounded-md text',
'border', 'border',
focused ? 'border-border-focus' : 'border-background-highlight', focused ? 'border-border-focus' : 'border-border-subtle',
!isValid && '!border-fg-danger', !isValid && '!border-danger',
size === 'md' && 'min-h-md', size === 'md' && 'min-h-md',
size === 'sm' && 'min-h-sm', size === 'sm' && 'min-h-sm',
size === 'xs' && 'min-h-xs', size === 'xs' && 'min-h-xs',
@@ -136,7 +136,7 @@ export const PlainInput = forwardRef<HTMLInputElement, PlainInputProps>(function
title={obscured ? `Show ${label}` : `Obscure ${label}`} title={obscured ? `Show ${label}` : `Obscure ${label}`}
size="xs" size="xs"
className="mr-0.5 group/obscure !h-auto my-0.5" className="mr-0.5 group/obscure !h-auto my-0.5"
iconClassName="text-fg-subtle group-hover/obscure:text-fg" iconClassName="text-text-subtle group-hover/obscure:text"
iconSize="sm" iconSize="sm"
icon={obscured ? 'eye' : 'eyeClosed'} icon={obscured ? 'eye' : 'eyeClosed'}
onClick={() => setObscured((o) => !o)} onClick={() => setObscured((o) => !o)}

View File

@@ -53,7 +53,7 @@ export function Select<T extends string>({
htmlFor={id} htmlFor={id}
className={classNames( className={classNames(
labelClassName, labelClassName,
'text-fg-subtle whitespace-nowrap', 'text-text-subtle whitespace-nowrap',
hideLabel && 'sr-only', hideLabel && 'sr-only',
)} )}
> >
@@ -63,10 +63,10 @@ export function Select<T extends string>({
<HStack <HStack
space={2} space={2}
className={classNames( className={classNames(
'w-full rounded-md text-fg text-sm font-mono', 'w-full rounded-md text text-sm font-mono',
'pl-2', 'pl-2',
'border', 'border',
focused ? 'border-border-focus' : 'border-background-highlight', focused ? 'border-border-focus' : 'border-border',
size === 'xs' && 'h-xs', size === 'xs' && 'h-xs',
size === 'sm' && 'h-sm', size === 'sm' && 'h-sm',
size === 'md' && 'h-md', size === 'md' && 'h-md',

View File

@@ -11,10 +11,12 @@ interface Props {
export function Separator({ className, dashed, orientation = 'horizontal', children }: Props) { export function Separator({ className, dashed, orientation = 'horizontal', children }: Props) {
return ( return (
<div role="separator" className={classNames(className, 'flex items-center')}> <div role="separator" className={classNames(className, 'flex items-center')}>
{children && <div className="text-sm text-fg-subtler mr-2 whitespace-nowrap">{children}</div>} {children && (
<div className="text-sm text-text-subtlest mr-2 whitespace-nowrap">{children}</div>
)}
<div <div
className={classNames( className={classNames(
'h-0 border-t border-t-background-highlight', 'h-0 border-t border-t-border-subtle',
dashed && 'border-dashed', dashed && 'border-dashed',
orientation === 'horizontal' && 'w-full h-[1px]', orientation === 'horizontal' && 'w-full h-[1px]',
orientation === 'vertical' && 'h-full w-[1px]', orientation === 'vertical' && 'h-full w-[1px]',

View File

@@ -16,12 +16,12 @@ export function StatusTag({ response, className, showReason }: Props) {
className={classNames( className={classNames(
className, className,
'font-mono', 'font-mono',
category === '0' && 'text-fg-danger', category === '0' && 'text-danger',
category === '1' && 'text-fg-info', category === '1' && 'text-info',
category === '2' && 'text-fg-success', category === '2' && 'text-success',
category === '3' && 'text-fg-primary', category === '3' && 'text-primary',
category === '4' && 'text-fg-warning', category === '4' && 'text-warning',
category === '5' && 'text-fg-danger', category === '5' && 'text-danger',
)} )}
> >
{label} {showReason && response.statusReason && response.statusReason} {label} {showReason && response.statusReason && response.statusReason}

View File

@@ -87,8 +87,8 @@ export function Tabs({
'h-full flex items-center rounded', 'h-full flex items-center rounded',
'!px-2 ml-[1px]', '!px-2 ml-[1px]',
addBorders && 'border', addBorders && 'border',
isActive ? 'text-fg' : 'text-fg-subtle hover:text-fg', isActive ? 'text-text' : 'text-text-subtle hover:text-text',
isActive && addBorders ? 'border-background-highlight' : 'border-transparent', isActive && addBorders ? 'border-border-subtle' : 'border-transparent',
); );
if ('options' in t) { if ('options' in t) {
@@ -103,7 +103,6 @@ export function Tabs({
onChange={t.options.onChange} onChange={t.options.onChange}
> >
<button <button
color="custom"
onClick={isActive ? undefined : () => handleTabChange(t.value)} onClick={isActive ? undefined : () => handleTabChange(t.value)}
className={btnClassName} className={btnClassName}
> >
@@ -113,7 +112,7 @@ export function Tabs({
<Icon <Icon
size="sm" size="sm"
icon="chevronDown" icon="chevronDown"
className={classNames('ml-1', isActive ? 'text-fg-subtle' : 'opacity-50')} className={classNames('ml-1', isActive ? 'text-text-subtle' : 'opacity-50')}
/> />
</button> </button>
</RadioDropdown> </RadioDropdown>
@@ -122,7 +121,6 @@ export function Tabs({
return ( return (
<button <button
key={t.value} key={t.value}
color="custom"
onClick={() => handleTabChange(t.value)} onClick={() => handleTabChange(t.value)}
className={btnClassName} className={btnClassName}
> >

View File

@@ -58,13 +58,13 @@ export function Toast({
className, className,
'x-theme-toast', 'x-theme-toast',
'pointer-events-auto', 'pointer-events-auto',
'relative bg-background pointer-events-auto', 'relative bg-surface pointer-events-auto',
'rounded-lg', 'rounded-lg',
'border border-background-highlight shadow-lg', 'border border-border-subtle shadow-lg',
'max-w-[calc(100vw-5rem)] max-h-[calc(100vh-6rem)]', 'max-w-[calc(100vw-5rem)] max-h-[calc(100vh-6rem)]',
'w-[22rem] max-h-[80vh]', 'w-[22rem] max-h-[80vh]',
'm-2 grid grid-cols-[1fr_auto]', 'm-2 grid grid-cols-[1fr_auto]',
'text-fg', 'text',
)} )}
> >
<div className="px-3 py-3 flex items-center gap-2"> <div className="px-3 py-3 flex items-center gap-2">
@@ -72,10 +72,10 @@ export function Toast({
<Icon <Icon
icon={icon} icon={icon}
className={classNames( className={classNames(
variant === 'success' && 'text-fg-success', variant === 'success' && 'text-success',
variant === 'warning' && 'text-fg-warning', variant === 'warning' && 'text-warning',
variant === 'error' && 'text-fg-danger', variant === 'error' && 'text-danger',
variant === 'copied' && 'text-fg-primary', variant === 'copied' && 'text-primary',
)} )}
/> />
)} )}
@@ -96,7 +96,7 @@ export function Toast({
{timeout != null && ( {timeout != null && (
<div className="w-full absolute bottom-0 left-0 right-0"> <div className="w-full absolute bottom-0 left-0 right-0">
<motion.div <motion.div
className="bg-background-highlight h-0.5" className="bg-surface-highlight h-0.5"
initial={{ width: '100%' }} initial={{ width: '100%' }}
animate={{ width: '0%', opacity: 0.2 }} animate={{ width: '0%', opacity: 0.2 }}
transition={{ duration: timeout / 1000, ease: 'linear' }} transition={{ duration: timeout / 1000, ease: 'linear' }}

View File

@@ -20,9 +20,9 @@ export function ImageViewer({ response, className }: Props) {
if (!show) { if (!show) {
return ( return (
<> <>
<div className="italic text-fg-subtler"> <div className="italic text-text-subtlest">
Response body is too large to preview.{' '} Response body is too large to preview.{' '}
<button className="cursor-pointer underline hover:text-fg" onClick={() => setShow(true)}> <button className="cursor-pointer underline hover:text" onClick={() => setShow(true)}>
Show anyway Show anyway
</button> </button>
</div> </div>

View File

@@ -68,19 +68,19 @@ export function TextViewer({ response, pretty, className }: Props) {
const canFilter = isJson || isXml; const canFilter = isJson || isXml;
const actions = useMemo<ReactNode[]>(() => { const actions = useMemo<ReactNode[]>(() => {
const result: ReactNode[] = []; const nodes: ReactNode[] = [];
if (!canFilter) return result; if (!canFilter) return nodes;
if (isSearching) { if (isSearching) {
result.push( nodes.push(
<div key="input" className="w-full !opacity-100"> <div key="input" className="w-full !opacity-100">
<Input <Input
key={response.id} key={response.id}
validate={!filteredResponse.error} validate={!filteredResponse.error}
hideLabel hideLabel
autoFocus autoFocus
containerClassName="bg-background" containerClassName="bg-surface"
size="sm" size="sm"
placeholder={isJson ? 'JSONPath expression' : 'XPath expression'} placeholder={isJson ? 'JSONPath expression' : 'XPath expression'}
label="Filter expression" label="Filter expression"
@@ -93,21 +93,18 @@ export function TextViewer({ response, pretty, className }: Props) {
); );
} }
result.push( nodes.push(
<IconButton <IconButton
key="icon" key="icon"
size="sm" size="sm"
icon={isSearching ? 'x' : 'filter'} icon={isSearching ? 'x' : 'filter'}
title={isSearching ? 'Close filter' : 'Filter response'} title={isSearching ? 'Close filter' : 'Filter response'}
onClick={toggleSearch} onClick={toggleSearch}
className={classNames( className={classNames('border !border-border-subtle', isSearching && '!opacity-100')}
'bg-background border !border-background-highlight',
isSearching && '!opacity-100',
)}
/>, />,
); );
return result; return nodes;
}, [ }, [
canFilter, canFilter,
filterText, filterText,

View File

@@ -24,7 +24,7 @@ export function WebPageViewer({ response }: Props) {
title="Response preview" title="Response preview"
srcDoc={contentForIframe} srcDoc={contentForIframe}
sandbox="allow-scripts allow-same-origin" sandbox="allow-scripts allow-same-origin"
className="h-full w-full rounded border border-background-highlight-secondary" className="h-full w-full rounded border border-border-subtle"
/> />
</div> </div>
); );

View File

@@ -52,7 +52,7 @@ export function Prompt({
onChange={setValue} onChange={setValue}
/> />
<HStack space={2} justifyContent="end"> <HStack space={2} justifyContent="end">
<Button onClick={onHide} variant="border"> <Button onClick={onHide} variant="border" color="secondary">
Cancel Cancel
</Button> </Button>
<Button type="submit" color="primary"> <Button type="submit" color="primary">

View File

@@ -1,5 +1,6 @@
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import type { Appearance } from './window';
type Appearance = 'light' | 'dark';
export function getCSSAppearance(): Appearance { export function getCSSAppearance(): Appearance {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';

View File

@@ -1,94 +0,0 @@
import parseColor from 'parse-color';
export class Color {
private theme: 'dark' | 'light' = 'light';
private hue: number = 0;
private saturation: number = 0;
private lightness: number = 0;
private alpha: number = 1;
constructor(cssColor: string, theme: 'dark' | 'light') {
try {
const { hsla } = parseColor(cssColor || '');
this.hue = hsla[0];
this.saturation = hsla[1];
this.lightness = hsla[2];
this.alpha = hsla[3] ?? 1;
this.theme = theme;
} catch (err) {
console.log('Failed to parse CSS color', cssColor, err);
}
}
static transparent(): Color {
return new Color('rgb(0,0,0)', 'light').translucify(1);
}
static white(): Color {
return new Color('rgb(0,0,0)', 'light').lower(1);
}
static black(): Color {
return new Color('rgb(0,0,0)', 'light').lift(1);
}
private clone(): Color {
return new Color(this.css(), this.theme);
}
lower(mod: number): Color {
return this.theme === 'dark' ? this._darken(mod) : this._lighten(mod);
}
lift(mod: number): Color {
return this.theme === 'dark' ? this._lighten(mod) : this._darken(mod);
}
translucify(mod: number): Color {
const c = this.clone();
c.alpha = c.alpha - c.alpha * mod;
return c;
}
desaturate(mod: number): Color {
const c = this.clone();
c.saturation = c.saturation - c.saturation * mod;
return c;
}
saturate(mod: number): Color {
const c = this.clone();
c.saturation = this.saturation + (100 - this.saturation) * mod;
return c;
}
lighterThan(c: Color): boolean {
return this.lightness > c.lightness;
}
css(): string {
// If opacity is 1, allow for Tailwind modification
const h = Math.round(this.hue);
const s = Math.round(this.saturation);
const l = Math.round(this.lightness);
const a = Math.round(this.alpha * 100) / 100;
return `hsla(${h}, ${s}%, ${l}%, ${a})`;
}
hex(): string {
return parseColor(this.css()).hex;
}
private _lighten(mod: number): Color {
const c = this.clone();
c.lightness = this.lightness + (100 - this.lightness) * mod;
return c;
}
private _darken(mod: number): Color {
const c = this.clone();
c.lightness = this.lightness - this.lightness * mod;
return c;
}
}

View File

@@ -1,9 +1,8 @@
import { catppuccin } from './themes/catppuccin'; import { catppuccin } from './themes/catppuccin';
import { dracula } from './themes/dracula';
import { github } from './themes/github'; import { github } from './themes/github';
import { hotdogStand } from './themes/hotdog-stand'; import { hotdogStand } from './themes/hotdog-stand';
import { monokaiPro } from './themes/monokai-pro'; import { monokaiPro } from './themes/monokai-pro';
import { moonlight } from './themes/moonlight'; import { relaxing } from './themes/relaxing';
import { rosePine } from './themes/rose-pine'; import { rosePine } from './themes/rose-pine';
import { yaak, yaakDark, yaakLight } from './themes/yaak'; import { yaak, yaakDark, yaakLight } from './themes/yaak';
@@ -13,10 +12,9 @@ export const defaultLightTheme = yaakLight;
export const yaakThemes = [ export const yaakThemes = [
...yaak, ...yaak,
...catppuccin, ...catppuccin,
...relaxing,
...rosePine, ...rosePine,
...monokaiPro,
...github, ...github,
...moonlight, ...monokaiPro,
...dracula,
...hotdogStand, ...hotdogStand,
]; ];

View File

@@ -1,32 +1,28 @@
import { Color } from '../color'; import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
export const catppuccinLatte: YaakTheme = { export const catppuccinLatte: YaakTheme = {
name: 'Catppuccin Latte', name: 'Catppuccin Latte',
id: 'catppuccin-latte', id: 'catppuccin-latte',
background: new Color('#eff1f5', 'light'), surface: new YaakColor('#eff1f5', 'light'),
foreground: new Color('#4c4f69', 'dark'), text: new YaakColor('#4c4f69', 'dark'),
foregroundSubtle: new Color('#6c6f85', 'light'), textSubtle: new YaakColor('#6c6f85', 'light'),
foregroundSubtler: new Color('#8c8fa1', 'light'), textSubtlest: new YaakColor('#8c8fa1', 'light'),
colors: { primary: new YaakColor('#8839ef', 'light'),
primary: new Color('#8839ef', 'light'), secondary: new YaakColor('#6c6f85', 'light'),
secondary: new Color('#6c6f85', 'light'), info: new YaakColor('#7287fd', 'light'),
info: new Color('#7287fd', 'light'), success: new YaakColor('#179299', 'light'),
success: new Color('#179299', 'light'), notice: new YaakColor('#df8e1d', 'light'),
notice: new Color('#df8e1d', 'light'), warning: new YaakColor('#fe640b', 'light'),
warning: new Color('#fe640b', 'light'), danger: new YaakColor('#e64553', 'light'),
danger: new Color('#e64553', 'light'),
},
components: { components: {
sidebar: { sidebar: {
background: new Color('#e6e9ef', 'light'), surface: new YaakColor('#e6e9ef', 'light'),
backgroundHighlight: new Color('#e6e9ef', 'light').lift(0.05), border: new YaakColor('#e6e9ef', 'light').lift(0.05),
foregroundSubtler: new Color('#7287fd', 'light'),
}, },
appHeader: { appHeader: {
background: new Color('#dce0e8', 'light'), surface: new YaakColor('#dce0e8', 'light'),
backgroundHighlight: new Color('#e6e9ef', 'light').lift(0.05), border: new YaakColor('#e6e9ef', 'light').lift(0.05),
foregroundSubtler: new Color('#7287fd', 'light'),
}, },
}, },
}; };
@@ -34,45 +30,41 @@ export const catppuccinLatte: YaakTheme = {
export const catppuccinMacchiato: YaakTheme = { export const catppuccinMacchiato: YaakTheme = {
name: 'Catppuccin Macchiato', name: 'Catppuccin Macchiato',
id: 'catppuccin-macchiato', id: 'catppuccin-macchiato',
background: new Color('#1e2030', 'dark'), surface: new YaakColor('#1e2030', 'dark'),
foreground: new Color('#cad3f5', 'dark'), text: new YaakColor('#cad3f5', 'dark'),
foregroundSubtle: new Color('#a5adcb', 'dark'), textSubtle: new YaakColor('#a5adcb', 'dark'),
foregroundSubtler: new Color('#8087a2', 'dark'), textSubtlest: new YaakColor('#8087a2', 'dark'),
colors: { primary: new YaakColor('#c6a0f6', 'dark'),
primary: new Color('#c6a0f6', 'dark'), secondary: new YaakColor('#b8c0e0', 'dark'),
secondary: new Color('#b8c0e0', 'dark'), info: new YaakColor('#8aadf4', 'dark'),
info: new Color('#8aadf4', 'dark'), success: new YaakColor('#a6da95', 'dark'),
success: new Color('#a6da95', 'dark'), notice: new YaakColor('#eed49f', 'dark'),
notice: new Color('#eed49f', 'dark'), warning: new YaakColor('#f5a97f', 'dark'),
warning: new Color('#f5a97f', 'dark'), danger: new YaakColor('#ed8796', 'dark'),
danger: new Color('#ed8796', 'dark'),
},
components: { components: {
dialog: { dialog: {
background: new Color('#181825', 'dark'), surface: new YaakColor('#181825', 'dark'),
}, },
sidebar: { sidebar: {
background: new Color('#24273a', 'dark'), surface: new YaakColor('#24273a', 'dark'),
backgroundHighlight: new Color('#24273a', 'dark').lift(0.05), border: new YaakColor('#24273a', 'dark').lift(0.05),
}, },
appHeader: { appHeader: {
background: new Color('#181926', 'dark'), surface: new YaakColor('#181926', 'dark'),
backgroundHighlight: new Color('#181926', 'dark').lift(0.1), border: new YaakColor('#181926', 'dark').lift(0.1),
}, },
responsePane: { responsePane: {
background: new Color('#24273a', 'dark'), surface: new YaakColor('#24273a', 'dark'),
backgroundHighlight: new Color('#24273a', 'dark').lift(0.05), border: new YaakColor('#24273a', 'dark').lift(0.05),
}, },
button: { button: {
colors: { primary: new YaakColor('#c6a0f6', 'dark').lower(0.1),
primary: new Color('#c6a0f6', 'dark').lower(0.1), secondary: new YaakColor('#b8c0e0', 'dark').lower(0.1),
secondary: new Color('#b8c0e0', 'dark').lower(0.1), info: new YaakColor('#8aadf4', 'dark').lower(0.1),
info: new Color('#8aadf4', 'dark').lower(0.1), success: new YaakColor('#a6da95', 'dark').lower(0.1),
success: new Color('#a6da95', 'dark').lower(0.1), notice: new YaakColor('#eed49f', 'dark').lower(0.1),
notice: new Color('#eed49f', 'dark').lower(0.1), warning: new YaakColor('#f5a97f', 'dark').lower(0.1),
warning: new Color('#f5a97f', 'dark').lower(0.1), danger: new YaakColor('#ed8796', 'dark').lower(0.1),
danger: new Color('#ed8796', 'dark').lower(0.1),
},
}, },
}, },
}; };
@@ -80,45 +72,41 @@ export const catppuccinMacchiato: YaakTheme = {
export const catppuccinFrappe: YaakTheme = { export const catppuccinFrappe: YaakTheme = {
name: 'Catppuccin Frappé', name: 'Catppuccin Frappé',
id: 'catppuccin-frappe', id: 'catppuccin-frappe',
background: new Color('#292c3c', 'dark'), surface: new YaakColor('#292c3c', 'dark'),
foreground: new Color('#c6d0f5', 'dark'), text: new YaakColor('#c6d0f5', 'dark'),
foregroundSubtle: new Color('#a5adce', 'dark'), textSubtle: new YaakColor('#a5adce', 'dark'),
foregroundSubtler: new Color('#838ba7', 'dark'), textSubtlest: new YaakColor('#838ba7', 'dark'),
colors: { primary: new YaakColor('#ca9ee6', 'dark'),
primary: new Color('#ca9ee6', 'dark'), secondary: new YaakColor('#b8c0e0', 'dark'),
secondary: new Color('#b8c0e0', 'dark'), info: new YaakColor('#8caaee', 'dark'),
info: new Color('#8caaee', 'dark'), success: new YaakColor('#a6d189', 'dark'),
success: new Color('#a6d189', 'dark'), notice: new YaakColor('#e5c890', 'dark'),
notice: new Color('#e5c890', 'dark'), warning: new YaakColor('#ef9f76', 'dark'),
warning: new Color('#ef9f76', 'dark'), danger: new YaakColor('#e78284', 'dark'),
danger: new Color('#e78284', 'dark'),
},
components: { components: {
dialog: { dialog: {
background: new Color('#181825', 'dark'), surface: new YaakColor('#181825', 'dark'),
}, },
sidebar: { sidebar: {
background: new Color('#303446', 'dark'), surface: new YaakColor('#303446', 'dark'),
backgroundHighlight: new Color('#303446', 'dark').lift(0.05), border: new YaakColor('#303446', 'dark').lift(0.05),
}, },
appHeader: { appHeader: {
background: new Color('#232634', 'dark'), surface: new YaakColor('#232634', 'dark'),
backgroundHighlight: new Color('#232634', 'dark').lift(0.1), border: new YaakColor('#232634', 'dark').lift(0.1),
}, },
responsePane: { responsePane: {
background: new Color('#303446', 'dark'), surface: new YaakColor('#303446', 'dark'),
backgroundHighlight: new Color('#303446', 'dark').lift(0.05), border: new YaakColor('#303446', 'dark').lift(0.05),
}, },
button: { button: {
colors: { primary: new YaakColor('#ca9ee6', 'dark').lower(0.1),
primary: new Color('#ca9ee6', 'dark').lower(0.1), secondary: new YaakColor('#b8c0e0', 'dark').lower(0.1),
secondary: new Color('#b8c0e0', 'dark').lower(0.1), info: new YaakColor('#8caaee', 'dark').lower(0.1),
info: new Color('#8caaee', 'dark').lower(0.1), success: new YaakColor('#a6d189', 'dark').lower(0.1),
success: new Color('#a6d189', 'dark').lower(0.1), notice: new YaakColor('#e5c890', 'dark').lower(0.1),
notice: new Color('#e5c890', 'dark').lower(0.1), warning: new YaakColor('#ef9f76', 'dark').lower(0.1),
warning: new Color('#ef9f76', 'dark').lower(0.1), danger: new YaakColor('#e78284', 'dark').lower(0.1),
danger: new Color('#e78284', 'dark').lower(0.1),
},
}, },
}, },
}; };
@@ -126,45 +114,41 @@ export const catppuccinFrappe: YaakTheme = {
const catppuccinMocha: YaakTheme = { const catppuccinMocha: YaakTheme = {
name: 'Catppuccin Mocha', name: 'Catppuccin Mocha',
id: 'catppuccin-mocha', id: 'catppuccin-mocha',
background: new Color('#181825', 'dark'), surface: new YaakColor('#181825', 'dark'),
foreground: new Color('#cdd6f4', 'dark'), text: new YaakColor('#cdd6f4', 'dark'),
foregroundSubtle: new Color('#a6adc8', 'dark'), textSubtle: new YaakColor('#a6adc8', 'dark'),
foregroundSubtler: new Color('#7f849c', 'dark'), textSubtlest: new YaakColor('#7f849c', 'dark'),
colors: { primary: new YaakColor('#c6a0f6', 'dark'),
primary: new Color('#c6a0f6', 'dark'), secondary: new YaakColor('#bac2de', 'dark'),
secondary: new Color('#bac2de', 'dark'), info: new YaakColor('#89b4fa', 'dark'),
info: new Color('#89b4fa', 'dark'), success: new YaakColor('#a6e3a1', 'dark'),
success: new Color('#a6e3a1', 'dark'), notice: new YaakColor('#f9e2af', 'dark'),
notice: new Color('#f9e2af', 'dark'), warning: new YaakColor('#fab387', 'dark'),
warning: new Color('#fab387', 'dark'), danger: new YaakColor('#f38ba8', 'dark'),
danger: new Color('#f38ba8', 'dark'),
},
components: { components: {
dialog: { dialog: {
background: new Color('#181825', 'dark'), surface: new YaakColor('#181825', 'dark'),
}, },
sidebar: { sidebar: {
background: new Color('#1e1e2e', 'dark'), surface: new YaakColor('#1e1e2e', 'dark'),
backgroundHighlight: new Color('#1e1e2e', 'dark').lift(0.05), border: new YaakColor('#1e1e2e', 'dark').lift(0.05),
}, },
appHeader: { appHeader: {
background: new Color('#11111b', 'dark'), surface: new YaakColor('#11111b', 'dark'),
backgroundHighlight: new Color('#11111b', 'dark').lift(0.1), border: new YaakColor('#11111b', 'dark').lift(0.1),
}, },
responsePane: { responsePane: {
background: new Color('#1e1e2e', 'dark'), surface: new YaakColor('#1e1e2e', 'dark'),
backgroundHighlight: new Color('#1e1e2e', 'dark').lift(0.05), border: new YaakColor('#1e1e2e', 'dark').lift(0.05),
}, },
button: { button: {
colors: { primary: new YaakColor('#cba6f7', 'dark').lower(0.2).desaturate(0.2),
primary: new Color('#cba6f7', 'dark').lower(0.2).desaturate(0.2), secondary: new YaakColor('#bac2de', 'dark').lower(0.2).desaturate(0.2),
secondary: new Color('#bac2de', 'dark').lower(0.2).desaturate(0.2), info: new YaakColor('#89b4fa', 'dark').lower(0.2).desaturate(0.2),
info: new Color('#89b4fa', 'dark').lower(0.2).desaturate(0.2), success: new YaakColor('#a6e3a1', 'dark').lower(0.2).desaturate(0.2),
success: new Color('#a6e3a1', 'dark').lower(0.2).desaturate(0.2), notice: new YaakColor('#f9e2af', 'dark').lower(0.2).desaturate(0.2),
notice: new Color('#f9e2af', 'dark').lower(0.2).desaturate(0.2), warning: new YaakColor('#fab387', 'dark').lower(0.2).desaturate(0.2),
warning: new Color('#fab387', 'dark').lower(0.2).desaturate(0.2), danger: new YaakColor('#f38ba8', 'dark').lower(0.2).desaturate(0.2),
danger: new Color('#f38ba8', 'dark').lower(0.2).desaturate(0.2),
},
}, },
}, },
}; };

View File

@@ -1,30 +1,27 @@
import { Color } from '../color';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
import { YaakColor } from '../yaakColor';
const draculaDefault: YaakTheme = { const draculaDefault: YaakTheme = {
id: 'dracula', id: 'dracula',
name: 'Dracula', name: 'Dracula',
background: new Color('#282A36', 'dark'), surface: new YaakColor('#282A36', 'dark'),
backgroundHighlight: new Color('#343746', 'dark'), surfaceHighlight: new YaakColor('#343746', 'dark'),
backgroundHighlightSecondary: new Color('#424450', 'dark'), text: new YaakColor('#F8F8F2', 'dark'),
foreground: new Color('#F8F8F2', 'dark'), textSubtle: new YaakColor('hsl(232,14%,65%)', 'dark'),
foregroundSubtle: new Color('hsl(232,14%,65%)', 'dark'), textSubtlest: new YaakColor('hsl(232,14%,50%)', 'dark'),
foregroundSubtler: new Color('hsl(232,14%,50%)', 'dark'), primary: new YaakColor('#BD93F9', 'dark'),
colors: { secondary: new YaakColor('#6272A4', 'dark'),
primary: new Color('#BD93F9', 'dark'), info: new YaakColor('#8BE9FD', 'dark'),
secondary: new Color('#6272A4', 'dark'), success: new YaakColor('#50FA7B', 'dark'),
info: new Color('#8BE9FD', 'dark'), notice: new YaakColor('#F1FA8C', 'dark'),
success: new Color('#50FA7B', 'dark'), warning: new YaakColor('#FFB86C', 'dark'),
notice: new Color('#F1FA8C', 'dark'), danger: new YaakColor('#FF5555', 'dark'),
warning: new Color('#FFB86C', 'dark'),
danger: new Color('#FF5555', 'dark'),
},
components: { components: {
sidebar: { sidebar: {
background: new Color('hsl(230,15%,24%)', 'dark'), backdrop: new YaakColor('hsl(230,15%,24%)', 'dark'),
}, },
appHeader: { appHeader: {
background: new Color('#21222C', 'dark'), backdrop: new YaakColor('#21222C', 'dark'),
}, },
}, },
}; };

View File

@@ -1,57 +1,52 @@
import { Color } from '../color'; import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
const githubDark: YaakTheme = { const githubDark: YaakTheme = {
id: 'github-dark', id: 'github-dark',
name: 'GitHub Dark', name: 'GitHub',
background: new Color('#0d1218', 'dark'), surface: new YaakColor('#0d1218', 'dark'),
backgroundHighlight: new Color('#171c23', 'dark'), border: new YaakColor('#171c23', 'dark'),
backgroundHighlightSecondary: new Color('#1c2127', 'dark'), surfaceHighlight: new YaakColor('#1c2127', 'dark'),
foreground: new Color('#dce3eb', 'dark'), text: new YaakColor('#dce3eb', 'dark'),
foregroundSubtle: new Color('#88919b', 'dark'), textSubtle: new YaakColor('#88919b', 'dark'),
foregroundSubtler: new Color('#6b727d', 'dark'), textSubtlest: new YaakColor('#6b727d', 'dark'),
colors: { primary: new YaakColor('#a579ef', 'dark').lift(0.1),
primary: new Color('#a579ef', 'dark').lift(0.1), secondary: new YaakColor('#6b727d', 'dark').lift(0.1),
secondary: new Color('#6b727d', 'dark').lift(0.1), info: new YaakColor('#458def', 'dark').lift(0.1),
info: new Color('#458def', 'dark').lift(0.1), success: new YaakColor('#3eb24f', 'dark').lift(0.1),
success: new Color('#3eb24f', 'dark').lift(0.1), notice: new YaakColor('#dca132', 'dark').lift(0.1),
notice: new Color('#dca132', 'dark').lift(0.1), warning: new YaakColor('#ec7934', 'dark').lift(0.1),
warning: new Color('#ec7934', 'dark').lift(0.1), danger: new YaakColor('#ee5049', 'dark').lift(0.1),
danger: new Color('#ee5049', 'dark').lift(0.1),
},
components: { components: {
button: { button: {
colors: { primary: new YaakColor('#a579ef', 'dark'),
primary: new Color('#a579ef', 'dark'), secondary: new YaakColor('#6b727d', 'dark'),
secondary: new Color('#6b727d', 'dark'), info: new YaakColor('#458def', 'dark'),
info: new Color('#458def', 'dark'), success: new YaakColor('#3eb24f', 'dark'),
success: new Color('#3eb24f', 'dark'), notice: new YaakColor('#dca132', 'dark'),
notice: new Color('#dca132', 'dark'), warning: new YaakColor('#ec7934', 'dark'),
warning: new Color('#ec7934', 'dark'), danger: new YaakColor('#ee5049', 'dark'),
danger: new Color('#ee5049', 'dark'),
},
}, },
}, },
}; };
export const githubLight: YaakTheme = { export const githubLight: YaakTheme = {
id: 'github-light', id: 'github-light',
name: 'GitHub Light', name: 'GitHub',
background: new Color('#ffffff', 'light'), surface: new YaakColor('#ffffff', 'light'),
backgroundHighlight: new Color('hsl(210,15%,92%)', 'light'), surfaceHighlight: new YaakColor('hsl(210,29%,94%)', 'light'),
backgroundHighlightSecondary: new Color('hsl(210,29%,94%)', 'light'), border: new YaakColor('hsl(210,15%,92%)', 'light'),
foreground: new Color('#1f2328', 'light'), borderSubtle: new YaakColor('hsl(210,15%,92%)', 'light'),
foregroundSubtle: new Color('#636c76', 'light'), text: new YaakColor('#1f2328', 'light'),
foregroundSubtler: new Color('#828d94', 'light'), textSubtle: new YaakColor('#636c76', 'light'),
colors: { textSubtlest: new YaakColor('#828d94', 'light'),
primary: new Color('#8250df', 'light'), primary: new YaakColor('#8250df', 'light'),
secondary: new Color('#6e7781', 'light'), secondary: new YaakColor('#6e7781', 'light'),
info: new Color('hsl(212,92%,48%)', 'light'), info: new YaakColor('hsl(212,92%,48%)', 'light'),
success: new Color('hsl(137,66%,32%)', 'light'), success: new YaakColor('hsl(137,66%,32%)', 'light'),
notice: new Color('hsl(40,100%,40%)', 'light'), notice: new YaakColor('hsl(40,100%,40%)', 'light'),
warning: new Color('hsl(24,100%,44%)', 'light'), warning: new YaakColor('hsl(24,100%,44%)', 'light'),
danger: new Color('#d1242f', 'light'), danger: new YaakColor('#d1242f', 'light'),
},
}; };
export const github = [githubDark, githubLight]; export const github = [githubDark, githubLight];

View File

@@ -1,59 +1,56 @@
import { Color } from '../color'; import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
export const hotdogStandDefault: YaakTheme = { export const hotdogStandDefault: YaakTheme = {
id: 'hotdog-stand', id: 'hotdog-stand',
name: 'Hotdog Stand', name: 'Hotdog Stand',
background: new Color('#ff0000', 'dark'), surface: new YaakColor('#ff0000', 'dark'),
backgroundHighlight: new Color('#000000', 'dark'), border: new YaakColor('#000000', 'dark'),
backgroundHighlightSecondary: new Color('#000000', 'dark'), surfaceHighlight: new YaakColor('#000000', 'dark'),
foreground: new Color('#ffffff', 'dark'), text: new YaakColor('#ffffff', 'dark'),
foregroundSubtle: new Color('#ffffff', 'dark'), textSubtle: new YaakColor('#ffffff', 'dark'),
foregroundSubtler: new Color('#ffff00', 'dark'), textSubtlest: new YaakColor('#ffff00', 'dark'),
colors: { primary: new YaakColor('#ffff00', 'dark'),
primary: new Color('#ffff00', 'dark'), secondary: new YaakColor('#ffff00', 'dark'),
secondary: new Color('#ffff00', 'dark'), info: new YaakColor('#ffff00', 'dark'),
info: new Color('#ffff00', 'dark'), success: new YaakColor('#ffff00', 'dark'),
notice: new Color('#ffff00', 'dark'), notice: new YaakColor('#ffff00', 'dark'),
warning: new Color('#ffff00', 'dark'), warning: new YaakColor('#ffff00', 'dark'),
danger: new Color('#ffff00', 'dark'), danger: new YaakColor('#ffff00', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#000000', 'dark'), surface: new YaakColor('#000000', 'dark'),
foreground: new Color('#ffffff', 'dark'), text: new YaakColor('#ffffff', 'dark'),
foregroundSubtle: new Color('#ffff00', 'dark'), textSubtle: new YaakColor('#ffff00', 'dark'),
foregroundSubtler: new Color('#ff0000', 'dark'), textSubtlest: new YaakColor('#ff0000', 'dark'),
}, },
menu: { menu: {
background: new Color('#000000', 'dark'), surface: new YaakColor('#000000', 'dark'),
backgroundHighlight: new Color('#ff0000', 'dark'), border: new YaakColor('#ff0000', 'dark'),
backgroundHighlightSecondary: new Color('#ff0000', 'dark'), surfaceHighlight: new YaakColor('#ff0000', 'dark'),
foreground: new Color('#ffffff', 'dark'), text: new YaakColor('#ffffff', 'dark'),
foregroundSubtle: new Color('#ffff00', 'dark'), textSubtle: new YaakColor('#ffff00', 'dark'),
foregroundSubtler: new Color('#ffff00', 'dark'), textSubtlest: new YaakColor('#ffff00', 'dark'),
}, },
button: { button: {
background: new Color('#000000', 'dark'), surface: new YaakColor('#000000', 'dark'),
foreground: new Color('#ffffff', 'dark'), text: new YaakColor('#ffffff', 'dark'),
colors: { primary: new YaakColor('#000000', 'dark'),
primary: new Color('#000000', 'dark'), secondary: new YaakColor('#ffffff', 'dark'),
secondary: new Color('#ffffff', 'dark'), info: new YaakColor('#000000', 'dark'),
info: new Color('#000000', 'dark'), success: new YaakColor('#ffff00', 'dark'),
notice: new Color('#ffff00', 'dark'), notice: new YaakColor('#ffff00', 'dark'),
warning: new Color('#000000', 'dark'), warning: new YaakColor('#000000', 'dark'),
danger: new Color('#ff0000', 'dark'), danger: new YaakColor('#ff0000', 'dark'),
},
}, },
editor: { editor: {
colors: { primary: new YaakColor('#ffffff', 'dark'),
primary: new Color('#ffffff', 'dark'), secondary: new YaakColor('#ffffff', 'dark'),
secondary: new Color('#ffffff', 'dark'), info: new YaakColor('#ffffff', 'dark'),
info: new Color('#ffffff', 'dark'), success: new YaakColor('#ffffff', 'dark'),
notice: new Color('#ffff00', 'dark'), notice: new YaakColor('#ffff00', 'dark'),
warning: new Color('#ffffff', 'dark'), warning: new YaakColor('#ffffff', 'dark'),
danger: new Color('#ffffff', 'dark'), danger: new YaakColor('#ffffff', 'dark'),
},
}, },
}, },
}; };

View File

@@ -1,41 +1,37 @@
import { Color } from '../color'; import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
export const monokaiProDefault: YaakTheme = { export const monokaiProDefault: YaakTheme = {
id: 'monokai-pro', id: 'monokai-pro',
name: 'Monokai Pro', name: 'Monokai Pro',
background: new Color('#2d2a2e', 'dark'), surface: new YaakColor('#2d2a2e', 'dark'),
foreground: new Color('#fcfcfa', 'dark'), text: new YaakColor('#fcfcfa', 'dark'),
foregroundSubtle: new Color('#c1c0c0', 'dark'), textSubtle: new YaakColor('#c1c0c0', 'dark'),
foregroundSubtler: new Color('#939293', 'dark'), textSubtlest: new YaakColor('#939293', 'dark'),
colors: { primary: new YaakColor('#ab9df2', 'dark'),
primary: new Color('#ab9df2', 'dark'), secondary: new YaakColor('#c1c0c0', 'dark'),
secondary: new Color('#c1c0c0', 'dark'), info: new YaakColor('#78dce8', 'dark'),
info: new Color('#78dce8', 'dark'), success: new YaakColor('#a9dc76', 'dark'),
success: new Color('#a9dc76', 'dark'), notice: new YaakColor('#ffd866', 'dark'),
notice: new Color('#ffd866', 'dark'), warning: new YaakColor('#fc9867', 'dark'),
warning: new Color('#fc9867', 'dark'), danger: new YaakColor('#ff6188', 'dark'),
danger: new Color('#ff6188', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#221f22', 'dark'), surface: new YaakColor('#221f22', 'dark'),
foreground: new Color('#c1c0c0', 'dark'), text: new YaakColor('#c1c0c0', 'dark'),
foregroundSubtle: new Color('#939293', 'dark'), textSubtle: new YaakColor('#939293', 'dark'),
foregroundSubtler: new Color('#727072', 'dark'), textSubtlest: new YaakColor('#727072', 'dark'),
}, },
button: { button: {
colors: { primary: new YaakColor('#ab9df2', 'dark').lower(0.1),
primary: new Color('#ab9df2', 'dark').lower(0.1), secondary: new YaakColor('#c1c0c0', 'dark').lower(0.1),
secondary: new Color('#c1c0c0', 'dark').lower(0.1), info: new YaakColor('#78dce8', 'dark').lower(0.1),
info: new Color('#78dce8', 'dark').lower(0.1), success: new YaakColor('#a9dc76', 'dark').lower(0.1),
success: new Color('#a9dc76', 'dark').lower(0.1), notice: new YaakColor('#ffd866', 'dark').lower(0.1),
notice: new Color('#ffd866', 'dark').lower(0.1), warning: new YaakColor('#fc9867', 'dark').lower(0.1),
warning: new Color('#fc9867', 'dark').lower(0.1), danger: new YaakColor('#ff6188', 'dark').lower(0.1),
danger: new Color('#ff6188', 'dark').lower(0.1),
},
}, },
}, },
}; };
@@ -43,38 +39,34 @@ export const monokaiProDefault: YaakTheme = {
const monokaiProClassic: YaakTheme = { const monokaiProClassic: YaakTheme = {
id: 'monokai-pro-classic', id: 'monokai-pro-classic',
name: 'Monokai Pro Classic', name: 'Monokai Pro Classic',
background: new Color('#272822', 'dark'), surface: new YaakColor('#272822', 'dark'),
foreground: new Color('#fdfff1', 'dark'), text: new YaakColor('#fdfff1', 'dark'),
foregroundSubtle: new Color('#c0c1b5', 'dark'), textSubtle: new YaakColor('#c0c1b5', 'dark'),
foregroundSubtler: new Color('#919288', 'dark'), textSubtlest: new YaakColor('#919288', 'dark'),
colors: { primary: new YaakColor('#ae81ff', 'dark'),
primary: new Color('#ae81ff', 'dark'), secondary: new YaakColor('#b2b9bd', 'dark'),
secondary: new Color('#b2b9bd', 'dark'), info: new YaakColor('#66d9ef', 'dark'),
info: new Color('#66d9ef', 'dark'), success: new YaakColor('#a6e22e', 'dark'),
success: new Color('#a6e22e', 'dark'), notice: new YaakColor('#e6db74', 'dark'),
notice: new Color('#e6db74', 'dark'), warning: new YaakColor('#fd971f', 'dark'),
warning: new Color('#fd971f', 'dark'), danger: new YaakColor('#f92672', 'dark'),
danger: new Color('#f92672', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#1d1e19', 'dark'), surface: new YaakColor('#1d1e19', 'dark'),
foreground: new Color('#b2b9bd', 'dark'), text: new YaakColor('#b2b9bd', 'dark'),
foregroundSubtle: new Color('#767b81', 'dark'), textSubtle: new YaakColor('#767b81', 'dark'),
foregroundSubtler: new Color('#696d77', 'dark'), textSubtlest: new YaakColor('#696d77', 'dark'),
}, },
button: { button: {
colors: { primary: new YaakColor('#ae81ff', 'dark').lower(0.1),
primary: new Color('#ae81ff', 'dark').lower(0.1), secondary: new YaakColor('#b2b9bd', 'dark').lower(0.1),
secondary: new Color('#b2b9bd', 'dark').lower(0.1), info: new YaakColor('#66d9ef', 'dark').lower(0.1),
info: new Color('#66d9ef', 'dark').lower(0.1), success: new YaakColor('#a6e22e', 'dark').lower(0.1),
success: new Color('#a6e22e', 'dark').lower(0.1), notice: new YaakColor('#e6db74', 'dark').lower(0.1),
notice: new Color('#e6db74', 'dark').lower(0.1), warning: new YaakColor('#fd971f', 'dark').lower(0.1),
warning: new Color('#fd971f', 'dark').lower(0.1), danger: new YaakColor('#f92672', 'dark').lower(0.1),
danger: new Color('#f92672', 'dark').lower(0.1),
},
}, },
}, },
}; };
@@ -82,38 +74,34 @@ const monokaiProClassic: YaakTheme = {
const monokaiProMachine: YaakTheme = { const monokaiProMachine: YaakTheme = {
id: 'monokai-pro-machine', id: 'monokai-pro-machine',
name: 'Monokai Pro Machine', name: 'Monokai Pro Machine',
background: new Color('#273136', 'dark'), surface: new YaakColor('#273136', 'dark'),
foreground: new Color('#eaf2f1', 'dark'), text: new YaakColor('#eaf2f1', 'dark'),
foregroundSubtle: new Color('#8b9798', 'dark'), textSubtle: new YaakColor('#8b9798', 'dark'),
foregroundSubtler: new Color('#6b7678', 'dark'), textSubtlest: new YaakColor('#6b7678', 'dark'),
colors: { primary: new YaakColor('#baa0f8', 'dark'),
primary: new Color('#baa0f8', 'dark'), secondary: new YaakColor('#b8c4c3', 'dark'),
secondary: new Color('#b8c4c3', 'dark'), info: new YaakColor('#7cd5f1', 'dark'),
info: new Color('#7cd5f1', 'dark'), success: new YaakColor('#a2e57b', 'dark'),
success: new Color('#a2e57b', 'dark'), notice: new YaakColor('#ffed72', 'dark'),
notice: new Color('#ffed72', 'dark'), warning: new YaakColor('#ffb270', 'dark'),
warning: new Color('#ffb270', 'dark'), danger: new YaakColor('#ff6d7e', 'dark'),
danger: new Color('#ff6d7e', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#1d2528', 'dark'), surface: new YaakColor('#1d2528', 'dark'),
foreground: new Color('#b2b9bd', 'dark'), text: new YaakColor('#b2b9bd', 'dark'),
foregroundSubtle: new Color('#767b81', 'dark'), textSubtle: new YaakColor('#767b81', 'dark'),
foregroundSubtler: new Color('#696d77', 'dark'), textSubtlest: new YaakColor('#696d77', 'dark'),
}, },
button: { button: {
colors: { primary: new YaakColor('#baa0f8', 'dark').lower(0.1),
primary: new Color('#baa0f8', 'dark').lower(0.1), secondary: new YaakColor('#b8c4c3', 'dark').lower(0.1),
secondary: new Color('#b8c4c3', 'dark').lower(0.1), info: new YaakColor('#7cd5f1', 'dark').lower(0.1),
info: new Color('#7cd5f1', 'dark').lower(0.1), success: new YaakColor('#a2e57b', 'dark').lower(0.1),
success: new Color('#a2e57b', 'dark').lower(0.1), notice: new YaakColor('#ffed72', 'dark').lower(0.1),
notice: new Color('#ffed72', 'dark').lower(0.1), warning: new YaakColor('#ffb270', 'dark').lower(0.1),
warning: new Color('#ffb270', 'dark').lower(0.1), danger: new YaakColor('#ff6d7e', 'dark').lower(0.1),
danger: new Color('#ff6d7e', 'dark').lower(0.1),
},
}, },
}, },
}; };
@@ -121,38 +109,34 @@ const monokaiProMachine: YaakTheme = {
const monokaiProOctagon: YaakTheme = { const monokaiProOctagon: YaakTheme = {
id: 'monokai-pro-octagon', id: 'monokai-pro-octagon',
name: 'Monokai Pro Octagon', name: 'Monokai Pro Octagon',
background: new Color('#282a3a', 'dark'), surface: new YaakColor('#282a3a', 'dark'),
foreground: new Color('#eaf2f1', 'dark'), text: new YaakColor('#eaf2f1', 'dark'),
foregroundSubtle: new Color('#b2b9bd', 'dark'), textSubtle: new YaakColor('#b2b9bd', 'dark'),
foregroundSubtler: new Color('#767b81', 'dark'), textSubtlest: new YaakColor('#767b81', 'dark'),
colors: { primary: new YaakColor('#c39ac9', 'dark'),
primary: new Color('#c39ac9', 'dark'), secondary: new YaakColor('#b2b9bd', 'dark'),
secondary: new Color('#b2b9bd', 'dark'), info: new YaakColor('#9cd1bb', 'dark'),
info: new Color('#9cd1bb', 'dark'), success: new YaakColor('#bad761', 'dark'),
success: new Color('#bad761', 'dark'), notice: new YaakColor('#ffd76d', 'dark'),
notice: new Color('#ffd76d', 'dark'), warning: new YaakColor('#ff9b5e', 'dark'),
warning: new Color('#ff9b5e', 'dark'), danger: new YaakColor('#ff657a', 'dark'),
danger: new Color('#ff657a', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#1e1f2b', 'dark'), surface: new YaakColor('#1e1f2b', 'dark'),
foreground: new Color('#b2b9bd', 'dark'), text: new YaakColor('#b2b9bd', 'dark'),
foregroundSubtle: new Color('#767b81', 'dark'), textSubtle: new YaakColor('#767b81', 'dark'),
foregroundSubtler: new Color('#696d77', 'dark'), textSubtlest: new YaakColor('#696d77', 'dark'),
}, },
button: { button: {
colors: { primary: new YaakColor('#c39ac9', 'dark').lower(0.1).desaturate(0.1),
primary: new Color('#c39ac9', 'dark').lower(0.1).desaturate(0.1), secondary: new YaakColor('#b2b9bd', 'dark').lower(0.1).desaturate(0.1),
secondary: new Color('#b2b9bd', 'dark').lower(0.1).desaturate(0.1), info: new YaakColor('#9cd1bb', 'dark').lower(0.1).desaturate(0.1),
info: new Color('#9cd1bb', 'dark').lower(0.1).desaturate(0.1), success: new YaakColor('#bad761', 'dark').lower(0.1).desaturate(0.1),
success: new Color('#bad761', 'dark').lower(0.1).desaturate(0.1), notice: new YaakColor('#ffd76d', 'dark').lower(0.1).desaturate(0.1),
notice: new Color('#ffd76d', 'dark').lower(0.1).desaturate(0.1), warning: new YaakColor('#ff9b5e', 'dark').lower(0.1).desaturate(0.1),
warning: new Color('#ff9b5e', 'dark').lower(0.1).desaturate(0.1), danger: new YaakColor('#ff657a', 'dark').lower(0.1).desaturate(0.1),
danger: new Color('#ff657a', 'dark').lower(0.1).desaturate(0.1),
},
}, },
}, },
}; };
@@ -160,38 +144,34 @@ const monokaiProOctagon: YaakTheme = {
const monokaiProRistretto: YaakTheme = { const monokaiProRistretto: YaakTheme = {
id: 'monokai-pro-ristretto', id: 'monokai-pro-ristretto',
name: 'Monokai Pro Ristretto', name: 'Monokai Pro Ristretto',
background: new Color('#2c2525', 'dark'), surface: new YaakColor('#2c2525', 'dark'),
foreground: new Color('#fff1f3', 'dark'), text: new YaakColor('#fff1f3', 'dark'),
foregroundSubtle: new Color('#c3b7b8', 'dark'), textSubtle: new YaakColor('#c3b7b8', 'dark'),
foregroundSubtler: new Color('#948a8b', 'dark'), textSubtlest: new YaakColor('#948a8b', 'dark'),
colors: { primary: new YaakColor('#a8a9eb', 'dark'),
primary: new Color('#a8a9eb', 'dark'), secondary: new YaakColor('#c3b7b8', 'dark'),
secondary: new Color('#c3b7b8', 'dark'), info: new YaakColor('#85dacc', 'dark'),
info: new Color('#85dacc', 'dark'), success: new YaakColor('#adda78', 'dark'),
success: new Color('#adda78', 'dark'), notice: new YaakColor('#f9cc6c', 'dark'),
notice: new Color('#f9cc6c', 'dark'), warning: new YaakColor('#f38d70', 'dark'),
warning: new Color('#f38d70', 'dark'), danger: new YaakColor('#fd6883', 'dark'),
danger: new Color('#fd6883', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#211c1c', 'dark'), surface: new YaakColor('#211c1c', 'dark'),
foreground: new Color('#c3b7b8', 'dark'), text: new YaakColor('#c3b7b8', 'dark'),
foregroundSubtle: new Color('#948a8b', 'dark'), textSubtle: new YaakColor('#948a8b', 'dark'),
foregroundSubtler: new Color('#72696a', 'dark'), textSubtlest: new YaakColor('#72696a', 'dark'),
}, },
button: { button: {
colors: { primary: new YaakColor('#a8a9eb', 'dark').lower(0.1),
primary: new Color('#a8a9eb', 'dark').lower(0.1), secondary: new YaakColor('#c3b7b8', 'dark').lower(0.1),
secondary: new Color('#c3b7b8', 'dark').lower(0.1), info: new YaakColor('#85dacc', 'dark').lower(0.1),
info: new Color('#85dacc', 'dark').lower(0.1), success: new YaakColor('#adda78', 'dark').lower(0.1),
success: new Color('#adda78', 'dark').lower(0.1), notice: new YaakColor('#f9cc6c', 'dark').lower(0.1),
notice: new Color('#f9cc6c', 'dark').lower(0.1), warning: new YaakColor('#f38d70', 'dark').lower(0.1),
warning: new Color('#f38d70', 'dark').lower(0.1), danger: new YaakColor('#fd6883', 'dark').lower(0.1),
danger: new Color('#fd6883', 'dark').lower(0.1),
},
}, },
}, },
}; };
@@ -199,38 +179,34 @@ const monokaiProRistretto: YaakTheme = {
const monokaiProSpectrum: YaakTheme = { const monokaiProSpectrum: YaakTheme = {
id: 'monokai-pro-spectrum', id: 'monokai-pro-spectrum',
name: 'Monokai Pro Spectrum', name: 'Monokai Pro Spectrum',
background: new Color('#222222', 'dark'), surface: new YaakColor('#222222', 'dark'),
foreground: new Color('#f7f1ff', 'dark'), text: new YaakColor('#f7f1ff', 'dark'),
foregroundSubtle: new Color('#bab6c0', 'dark'), textSubtle: new YaakColor('#bab6c0', 'dark'),
foregroundSubtler: new Color('#8b888f', 'dark'), textSubtlest: new YaakColor('#8b888f', 'dark'),
colors: { primary: new YaakColor('#948ae3', 'dark'),
primary: new Color('#948ae3', 'dark'), secondary: new YaakColor('#bab6c0', 'dark'),
secondary: new Color('#bab6c0', 'dark'), info: new YaakColor('#5ad4e6', 'dark'),
info: new Color('#5ad4e6', 'dark'), success: new YaakColor('#7bd88f', 'dark'),
success: new Color('#7bd88f', 'dark'), notice: new YaakColor('#fce566', 'dark'),
notice: new Color('#fce566', 'dark'), warning: new YaakColor('#fd9353', 'dark'),
warning: new Color('#fd9353', 'dark'), danger: new YaakColor('#fc618d', 'dark'),
danger: new Color('#fc618d', 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color('#191919', 'dark'), surface: new YaakColor('#191919', 'dark'),
foreground: new Color('#bab6c0', 'dark'), text: new YaakColor('#bab6c0', 'dark'),
foregroundSubtle: new Color('#8b888f', 'dark'), textSubtle: new YaakColor('#8b888f', 'dark'),
foregroundSubtler: new Color('#69676c', 'dark'), textSubtlest: new YaakColor('#69676c', 'dark'),
}, },
button: { button: {
colors: { primary: new YaakColor('#948ae3', 'dark').lower(0.1),
primary: new Color('#948ae3', 'dark').lower(0.1), secondary: new YaakColor('#bab6c0', 'dark').lower(0.1),
secondary: new Color('#bab6c0', 'dark').lower(0.1), info: new YaakColor('#5ad4e6', 'dark').lower(0.1),
info: new Color('#5ad4e6', 'dark').lower(0.1), success: new YaakColor('#7bd88f', 'dark').lower(0.1),
success: new Color('#7bd88f', 'dark').lower(0.1), notice: new YaakColor('#fce566', 'dark').lower(0.1),
notice: new Color('#fce566', 'dark').lower(0.1), warning: new YaakColor('#fd9353', 'dark').lower(0.1),
warning: new Color('#fd9353', 'dark').lower(0.1), danger: new YaakColor('#fc618d', 'dark').lower(0.1),
danger: new Color('#fc618d', 'dark').lower(0.1),
},
}, },
}, },
}; };

View File

@@ -1,5 +1,5 @@
import { Color } from '../color';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
import { YaakColor } from '../yaakColor';
export const colors = { export const colors = {
lightRed: '#ff98a4', lightRed: '#ff98a4',
@@ -40,25 +40,23 @@ export const colors = {
const moonlightDefault: YaakTheme = { const moonlightDefault: YaakTheme = {
id: 'moonlight', id: 'moonlight',
name: 'Moonlight', name: 'Moonlight',
background: new Color('#222436', 'dark'), surface: new YaakColor('#222436', 'dark'),
foreground: new Color('#d5def8', 'dark'), text: new YaakColor('#d5def8', 'dark'),
foregroundSubtle: new Color('#828bb8', 'dark'), textSubtle: new YaakColor('#828bb8', 'dark'),
foregroundSubtler: new Color('hsl(232,26%,43%)', 'dark'), textSubtlest: new YaakColor('hsl(232,26%,43%)', 'dark'),
colors: { primary: new YaakColor(colors.purple, 'dark'),
primary: new Color(colors.purple, 'dark'), secondary: new YaakColor(colors.desaturatedGray, 'dark'),
secondary: new Color(colors.desaturatedGray, 'dark'), info: new YaakColor(colors.blue, 'dark'),
info: new Color(colors.blue, 'dark'), success: new YaakColor(colors.teal, 'dark'),
success: new Color(colors.teal, 'dark'), notice: new YaakColor(colors.yellow, 'dark'),
notice: new Color(colors.yellow, 'dark'), warning: new YaakColor(colors.orange, 'dark'),
warning: new Color(colors.orange, 'dark'), danger: new YaakColor(colors.red, 'dark'),
danger: new Color(colors.red, 'dark'),
},
components: { components: {
appHeader: { appHeader: {
background: new Color(colors.gray3, 'dark'), surface: new YaakColor(colors.gray3, 'dark'),
}, },
sidebar: { sidebar: {
background: new Color(colors.gray3, 'dark'), surface: new YaakColor(colors.gray3, 'dark'),
}, },
}, },
}; };

View File

@@ -0,0 +1,18 @@
import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window';
const relaxingDefault: YaakTheme = {
name: 'Relaxing',
id: 'relaxing',
surface: new YaakColor('#2b1e3b', 'dark'),
text: new YaakColor('#ede2f5', 'dark'),
primary: new YaakColor('#cba6f7', 'dark'),
secondary: new YaakColor('#bac2de', 'dark'),
info: new YaakColor('#89b4fa', 'dark'),
success: new YaakColor('#a6e3a1', 'dark'),
notice: new YaakColor('#f9e2af', 'dark'),
warning: new YaakColor('#fab387', 'dark'),
danger: new YaakColor('#f38ba8', 'dark'),
};
export const relaxing = [relaxingDefault];

View File

@@ -1,33 +1,31 @@
import { Color } from '../color'; import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
export const rosePineDefault: YaakTheme = { export const rosePineDefault: YaakTheme = {
id: 'rose-pine', id: 'rose-pine',
name: 'Rosé Pine', name: 'Rosé Pine',
background: new Color('#191724', 'dark'), surface: new YaakColor('#191724', 'dark'),
foreground: new Color('#e0def4', 'dark'), text: new YaakColor('#e0def4', 'dark'),
foregroundSubtle: new Color('#908caa', 'dark'), textSubtle: new YaakColor('#908caa', 'dark'),
foregroundSubtler: new Color('#6e6a86', 'dark'), textSubtlest: new YaakColor('#6e6a86', 'dark'),
colors: { primary: new YaakColor('#c4a7e7', 'dark'),
primary: new Color('#c4a7e7', 'dark'), secondary: new YaakColor('#6e6a86', 'dark'),
secondary: new Color('#6e6a86', 'dark'), info: new YaakColor('#67abcb', 'dark'),
info: new Color('#67abcb', 'dark'), success: new YaakColor('#9cd8d8', 'dark'),
success: new Color('#9cd8d8', 'dark'), notice: new YaakColor('#f6c177', 'dark'),
notice: new Color('#f6c177', 'dark'), warning: new YaakColor('#f1a3a1', 'dark'),
warning: new Color('#f1a3a1', 'dark'), danger: new YaakColor('#eb6f92', 'dark'),
danger: new Color('#eb6f92', 'dark'),
},
components: { components: {
responsePane: { responsePane: {
background: new Color('#1f1d2e', 'dark'), surface: new YaakColor('#1f1d2e', 'dark'),
}, },
sidebar: { sidebar: {
background: new Color('#1f1d2e', 'dark'), surface: new YaakColor('#1f1d2e', 'dark'),
}, },
menu: { menu: {
background: new Color('#393552', 'dark'), surface: new YaakColor('#393552', 'dark'),
foregroundSubtle: new Color('#908caa', 'dark').lift(0.15), textSubtle: new YaakColor('#908caa', 'dark').lift(0.15),
foregroundSubtler: new Color('#6e6a86', 'dark').lift(0.15), textSubtlest: new YaakColor('#6e6a86', 'dark').lift(0.15),
}, },
}, },
}; };
@@ -35,30 +33,28 @@ export const rosePineDefault: YaakTheme = {
const rosePineMoon: YaakTheme = { const rosePineMoon: YaakTheme = {
id: 'rose-pine-moon', id: 'rose-pine-moon',
name: 'Rosé Pine Moon', name: 'Rosé Pine Moon',
background: new Color('#232136', 'dark'), surface: new YaakColor('#232136', 'dark'),
foreground: new Color('#e0def4', 'dark'), text: new YaakColor('#e0def4', 'dark'),
foregroundSubtle: new Color('#908caa', 'dark'), textSubtle: new YaakColor('#908caa', 'dark'),
foregroundSubtler: new Color('#6e6a86', 'dark'), textSubtlest: new YaakColor('#6e6a86', 'dark'),
colors: { primary: new YaakColor('#c4a7e7', 'dark'),
primary: new Color('#c4a7e7', 'dark'), secondary: new YaakColor('#908caa', 'dark'),
secondary: new Color('#908caa', 'dark'), info: new YaakColor('#68aeca', 'dark'),
info: new Color('#68aeca', 'dark'), success: new YaakColor('#9ccfd8', 'dark'),
success: new Color('#9ccfd8', 'dark'), notice: new YaakColor('#f6c177', 'dark'),
notice: new Color('#f6c177', 'dark'), warning: new YaakColor('#ea9a97', 'dark'),
warning: new Color('#ea9a97', 'dark'), danger: new YaakColor('#eb6f92', 'dark'),
danger: new Color('#eb6f92', 'dark'),
},
components: { components: {
responsePane: { responsePane: {
background: new Color('#2a273f', 'dark'), surface: new YaakColor('#2a273f', 'dark'),
}, },
sidebar: { sidebar: {
background: new Color('#2a273f', 'dark'), surface: new YaakColor('#2a273f', 'dark'),
}, },
menu: { menu: {
background: new Color('#393552', 'dark'), surface: new YaakColor('#393552', 'dark'),
foregroundSubtle: new Color('#908caa', 'dark').lift(0.15), textSubtle: new YaakColor('#908caa', 'dark').lift(0.15),
foregroundSubtler: new Color('#6e6a86', 'dark').lift(0.15), textSubtlest: new YaakColor('#6e6a86', 'dark').lift(0.15),
}, },
}, },
}; };
@@ -66,39 +62,39 @@ const rosePineMoon: YaakTheme = {
const rosePineDawn: YaakTheme = { const rosePineDawn: YaakTheme = {
id: 'rose-pine-dawn', id: 'rose-pine-dawn',
name: 'Rosé Pine Dawn', name: 'Rosé Pine Dawn',
background: new Color('#faf4ed', 'light'), surface: new YaakColor('#faf4ed', 'light'),
backgroundHighlight: new Color('#dfdad9', 'light'), border: new YaakColor('#dfdad9', 'light'),
backgroundHighlightSecondary: new Color('#f4ede8', 'light'), surfaceHighlight: new YaakColor('#f4ede8', 'light'),
foreground: new Color('#575279', 'light'), text: new YaakColor('#575279', 'light'),
foregroundSubtle: new Color('#797593', 'light'), textSubtle: new YaakColor('#797593', 'light'),
foregroundSubtler: new Color('#9893a5', 'light'), textSubtlest: new YaakColor('#9893a5', 'light'),
colors: { primary: new YaakColor('#9070ad', 'light'),
primary: new Color('#9070ad', 'light'), secondary: new YaakColor('#6e6a86', 'light'),
secondary: new Color('#6e6a86', 'light'), info: new YaakColor('#2d728d', 'light'),
info: new Color('#2d728d', 'light'), success: new YaakColor('#4f8c96', 'light'),
success: new Color('#4f8c96', 'light'), notice: new YaakColor('#cb862d', 'light'),
notice: new Color('#cb862d', 'light'), warning: new YaakColor('#ce7b78', 'light'),
warning: new Color('#ce7b78', 'light'), danger: new YaakColor('#b4637a', 'light'),
danger: new Color('#b4637a', 'light'),
},
components: { components: {
responsePane: { responsePane: {
backgroundHighlight: new Color('#e8e4e2', 'light'), border: new YaakColor('#e8e4e2', 'light'),
}, },
sidebar: { sidebar: {
backgroundHighlight: new Color('#e8e4e2', 'light'), border: new YaakColor('#e8e4e2', 'light'),
}, },
appHeader: { appHeader: {
backgroundHighlight: new Color('#e8e4e2', 'light'), border: new YaakColor('#e8e4e2', 'light'),
}, },
input: { input: {
backgroundHighlight: new Color('#dfdad9', 'light'), border: new YaakColor('#dfdad9', 'light'),
}, },
dialog: { dialog: {
backgroundHighlight: new Color('#e8e4e2', 'light'), border: new YaakColor('#e8e4e2', 'light'),
}, },
menu: { menu: {
background: new Color('#f2e9e1', 'light'), surface: new YaakColor('#f2e9e1', 'light'),
border: new YaakColor('#dfdad9', 'light'),
surfaceHighlight: new YaakColor('#6e6a86', 'light'),
}, },
}, },
}; };

View File

@@ -1,82 +1,72 @@
import { Color } from '../color'; import { YaakColor } from '../yaakColor';
import type { YaakTheme } from '../window'; import type { YaakTheme } from '../window';
export const yaakLight: YaakTheme = { export const yaakLight: YaakTheme = {
id: 'yaak-light', id: 'yaak-light',
name: 'Yaak Light', name: 'Yaak',
background: new Color('hsl(216,24%,100%)', 'light'), surface: new YaakColor('hsl(216,24%,100%)', 'light'),
backgroundHighlight: new Color('hsl(216,24%,93%)', 'light'), border: new YaakColor('hsl(216,24%,93%)', 'light'),
backgroundHighlightSecondary: new Color('hsl(216,24%,87%)', 'light'), surfaceHighlight: new YaakColor('hsl(216,24%,87%)', 'light'),
foreground: new Color('hsl(219,23%,15%)', 'light'), text: new YaakColor('hsl(219,23%,15%)', 'light'),
foregroundSubtle: new Color('hsl(219,23%,15%)', 'light').lower(0.3), textSubtle: new YaakColor('hsl(219,23%,15%)', 'light').lower(0.3),
foregroundSubtler: new Color('hsl(219,23%,15%)', 'light').lower(0.5), textSubtlest: new YaakColor('hsl(219,23%,15%)', 'light').lower(0.5),
colors: { primary: new YaakColor('hsl(266,100%,70%)', 'light'),
primary: new Color('hsl(266,100%,70%)', 'light'), secondary: new YaakColor('hsl(220,24%,59%)', 'light'),
secondary: new Color('hsl(220,24%,59%)', 'light'), info: new YaakColor('hsl(206,100%,48%)', 'light'),
info: new Color('hsl(206,100%,48%)', 'light'), success: new YaakColor('hsl(155,95%,33%)', 'light'),
success: new Color('hsl(155,95%,33%)', 'light'), notice: new YaakColor('hsl(45,100%,41%)', 'light'),
notice: new Color('hsl(45,100%,41%)', 'light'), warning: new YaakColor('hsl(30,100%,43%)', 'light'),
warning: new Color('hsl(30,100%,43%)', 'light'), danger: new YaakColor('hsl(335,75%,57%)', 'light'),
danger: new Color('hsl(335,75%,57%)', 'light'),
},
components: { components: {
sidebar: { sidebar: {
background: new Color('hsl(216,24%,97%)', 'light'), surface: new YaakColor('hsl(216,24%,97%)', 'light'),
backgroundHighlight: new Color('hsl(216,24%,93%)', 'light'), border: new YaakColor('hsl(216,24%,93%)', 'light'),
backgroundHighlightSecondary: new Color('hsl(216,24%,90%)', 'light'), surfaceHighlight: new YaakColor('hsl(216,24%,90%)', 'light'),
}, },
}, },
}; };
export const yaakDark: YaakTheme = { export const yaakDark: YaakTheme = {
id: 'yaak-dark', id: 'yaak-dark',
name: 'Yaak Dark', name: 'Yaak',
background: new Color('hsl(244,23%,14%)', 'dark'), surface: new YaakColor('hsl(244,23%,14%)', 'dark'),
backgroundHighlight: new Color('hsl(244,23%,23%)', 'dark'), border: new YaakColor('hsl(244,23%,25%)', 'dark'),
backgroundHighlightSecondary: new Color('hsl(244,23%,20%)', 'dark'), surfaceHighlight: new YaakColor('hsl(244,23%,20%)', 'dark'),
foreground: new Color('hsl(245,23%,83%)', 'dark'), text: new YaakColor('hsl(245,23%,84%)', 'dark'),
foregroundSubtle: new Color('hsl(245,20%,65%)', 'dark'), textSubtle: new YaakColor('hsl(245,18%,58%)', 'dark'),
foregroundSubtler: new Color('hsl(245,18%,51%)', 'dark'), textSubtlest: new YaakColor('hsl(245,18%,45%)', 'dark'),
primary: new YaakColor('hsl(266,100%,79%)', 'dark'),
colors: { secondary: new YaakColor('hsl(245,23%,60%)', 'dark'),
primary: new Color('hsl(266,100%,79%)', 'dark'), info: new YaakColor('hsl(206,100%,63%)', 'dark'),
secondary: new Color('hsl(245,23%,60%)', 'dark'), success: new YaakColor('hsl(150,99%,44%)', 'dark'),
info: new Color('hsl(206,100%,63%)', 'dark'), notice: new YaakColor('hsl(48,80%,63%)', 'dark'),
success: new Color('hsl(150,99%,44%)', 'dark'), warning: new YaakColor('hsl(28,100%,61%)', 'dark'),
notice: new Color('hsl(48,80%,63%)', 'dark'), danger: new YaakColor('hsl(342,90%,68%)', 'dark'),
warning: new Color('hsl(28,100%,61%)', 'dark'),
danger: new Color('hsl(342,90%,68%)', 'dark'),
},
components: { components: {
button: { button: {
colors: { primary: new YaakColor('hsl(266,100%,79%)', 'dark').lower(0.1),
primary: new Color('hsl(266,100%,79%)', 'dark').lower(0.1), secondary: new YaakColor('hsl(245,23%,60%)', 'dark').lower(0.1),
secondary: new Color('hsl(245,23%,60%)', 'dark').lower(0.1), info: new YaakColor('hsl(206,100%,63%)', 'dark').lower(0.1),
info: new Color('hsl(206,100%,63%)', 'dark').lower(0.1), success: new YaakColor('hsl(150,99%,44%)', 'dark').lower(0.15),
success: new Color('hsl(150,99%,44%)', 'dark').lower(0.15), notice: new YaakColor('hsl(48,80%,63%)', 'dark').lower(0.2),
notice: new Color('hsl(48,80%,63%)', 'dark').lower(0.2), warning: new YaakColor('hsl(28,100%,61%)', 'dark').lower(0.1),
warning: new Color('hsl(28,100%,61%)', 'dark').lower(0.1), danger: new YaakColor('hsl(342,90%,68%)', 'dark').lower(0.1),
danger: new Color('hsl(342,90%,68%)', 'dark').lower(0.1),
},
},
input: {
backgroundHighlight: new Color('hsl(244,23%,24%)', 'dark'),
}, },
dialog: { dialog: {
backgroundHighlight: new Color('hsl(244,23%,24%)', 'dark'), border: new YaakColor('hsl(244,23%,24%)', 'dark'),
}, },
sidebar: { sidebar: {
background: new Color('hsl(243,23%,16%)', 'dark'), surface: new YaakColor('hsl(243,23%,16%)', 'dark'),
backgroundHighlight: new Color('hsl(244,23%,22%)', 'dark'), border: new YaakColor('hsl(244,23%,22%)', 'dark'),
}, },
responsePane: { responsePane: {
background: new Color('hsl(243,23%,16%)', 'dark'), surface: new YaakColor('hsl(243,23%,16%)', 'dark'),
backgroundHighlight: new Color('hsl(244,23%,16%)', 'dark').lift(0.08), border: new YaakColor('hsl(244,23%,16%)', 'dark').lift(0.08),
}, },
appHeader: { appHeader: {
background: new Color('hsl(244,23%,12%)', 'dark'), surface: new YaakColor('hsl(244,23%,12%)', 'dark'),
backgroundHighlight: new Color('hsl(244,23%,12%)', 'dark').lift(0.1), border: new YaakColor('hsl(244,23%,12%)', 'dark').lift(0.1),
}, },
}, },
}; };

View File

@@ -1,138 +1,166 @@
import { Color } from './color'; import { defaultDarkTheme, defaultLightTheme } from './themes';
import { YaakColor } from './yaakColor';
export type Appearance = 'dark' | 'light' | 'system'; export type YaakColors = {
surface: YaakColor;
surfaceHighlight?: YaakColor;
surfaceActive?: YaakColor;
interface ThemeComponent { text: YaakColor;
background?: Color; textSubtle?: YaakColor;
backgroundHighlight?: Color; textSubtlest?: YaakColor;
backgroundHighlightSecondary?: Color;
backgroundActive?: Color;
foreground?: Color;
foregroundSubtle?: Color;
foregroundSubtler?: Color;
shadow?: Color;
colors?: Partial<RootColors>;
}
export interface YaakTheme extends ThemeComponent { border?: YaakColor;
borderSubtle?: YaakColor;
borderFocus?: YaakColor;
shadow?: YaakColor;
backdrop?: YaakColor;
selection?: YaakColor;
primary?: YaakColor;
secondary?: YaakColor;
info?: YaakColor;
success?: YaakColor;
notice?: YaakColor;
warning?: YaakColor;
danger?: YaakColor;
};
export type YaakTheme = YaakColors & {
id: string; id: string;
name: string; name: string;
components?: { components?: Partial<{
dialog?: ThemeComponent; dialog: Partial<YaakColors>;
menu?: ThemeComponent; menu: Partial<YaakColors>;
toast?: ThemeComponent; toast: Partial<YaakColors>;
sidebar?: ThemeComponent; sidebar: Partial<YaakColors>;
responsePane?: ThemeComponent; responsePane: Partial<YaakColors>;
appHeader?: ThemeComponent; appHeader: Partial<YaakColors>;
button?: ThemeComponent; button: Partial<YaakColors>;
banner?: ThemeComponent; banner: Partial<YaakColors>;
placeholder?: ThemeComponent; placeholder: Partial<YaakColors>;
urlBar?: ThemeComponent; urlBar: Partial<YaakColors>;
editor?: ThemeComponent; editor: Partial<YaakColors>;
input?: ThemeComponent; input: Partial<YaakColors>;
}; }>;
} };
interface RootColors { export type YaakColorKey = keyof YaakColors;
primary: Color;
secondary: Color;
info: Color;
success: Color;
notice: Color;
warning: Color;
danger: Color;
}
type ColorName = keyof RootColors;
type ComponentName = keyof NonNullable<YaakTheme['components']>; type ComponentName = keyof NonNullable<YaakTheme['components']>;
type CSSVariables = Record<string, string | undefined>; type CSSVariables = Record<YaakColorKey, YaakColor | undefined>;
function themeVariables(theme?: ThemeComponent, base?: CSSVariables): CSSVariables | null { function themeVariables(theme?: Partial<YaakColors>, base?: CSSVariables): CSSVariables | null {
const vars: CSSVariables = { const vars: CSSVariables = {
'--background': theme?.background?.css(), surface: theme?.surface,
'--background-highlight': surfaceHighlight: theme?.surfaceHighlight ?? theme?.surface?.lift(0.06),
theme?.backgroundHighlight?.css() ?? theme?.background?.lift(0.11).css(), surfaceActive: theme?.surfaceActive ?? theme?.primary?.lower(0.2).translucify(0.8),
'--background-highlight-secondary': backdrop: theme?.surface?.lower(0.2).translucify(0.2),
theme?.backgroundHighlightSecondary?.css() ?? theme?.background?.lift(0.06).css(), selection: theme?.primary?.lower(0.1).translucify(0.7),
'--background-active': border: theme?.border ?? theme?.surface?.lift(0.11),
theme?.backgroundActive?.css() ?? theme?.colors?.primary?.lower(0.2).translucify(0.8).css(), borderSubtle: theme?.borderSubtle ?? theme?.border?.lower(0.06),
'--background-backdrop': theme?.background?.lower(0.2).translucify(0.2).css(), borderFocus: theme?.info?.translucify(0.5),
'--background-selection': theme?.colors?.primary?.lower(0.1).translucify(0.7).css(), text: theme?.text,
'--fg': theme?.foreground?.css(), textSubtle: theme?.textSubtle ?? theme?.text?.lower(0.2),
'--fg-subtle': theme?.foregroundSubtle?.css() ?? theme?.foreground?.lower(0.2).css(), textSubtlest: theme?.textSubtlest ?? theme?.text?.lower(0.3),
'--fg-subtler': theme?.foregroundSubtler?.css() ?? theme?.foreground?.lower(0.3).css(), shadow:
'--border-focus': theme?.colors?.info?.css(), theme?.shadow ??
'--shadow': YaakColor.black().translucify(isThemeDark(theme ?? ({} as Partial<YaakColors>)) ? 0.7 : 0.93),
theme?.shadow?.css() ?? primary: theme?.primary,
Color.black() secondary: theme?.primary,
.translucify(isThemeDark(theme ?? {}) ? 0.7 : 0.93) info: theme?.info,
.css(), success: theme?.success,
notice: theme?.notice,
warning: theme?.warning,
danger: theme?.danger,
}; };
for (const [color, value] of Object.entries(theme?.colors ?? {})) {
vars[`--fg-${color}`] = (value as Color).css();
}
// Extend with base // Extend with base
for (const [k, v] of Object.entries(vars)) { for (const [k, v] of Object.entries(vars)) {
if (!v && base?.[k]) { if (!v && base?.[k as YaakColorKey]) {
vars[k] = base[k]; vars[k as YaakColorKey] = base[k as YaakColorKey];
} }
} }
return vars; return vars;
} }
function placeholderColorVariables(color: Color): CSSVariables { function placeholderColorVariables(color: YaakColor): Partial<CSSVariables> {
return { return {
'--fg': color.lift(0.6).css(), text: color.lift(0.6),
'--fg-subtle': color.lift(0.4).css(), textSubtle: color.lift(0.4),
'--fg-subtler': color.css(), textSubtlest: color,
'--background': color.lower(0.2).translucify(0.8).css(), surface: color.lower(0.2).translucify(0.8),
'--background-highlight': color.lower(0.2).translucify(0.2).css(), border: color.lower(0.2).translucify(0.2),
'--background-highlight-secondary': color.lower(0.1).translucify(0.7).css(), surfaceHighlight: color.lower(0.1).translucify(0.7),
}; };
} }
function bannerColorVariables(color: Color): CSSVariables { function bannerColorVariables(color: YaakColor): Partial<CSSVariables> {
return { return {
'--fg': color.lift(0.8).css(), text: color.lift(0.8),
'--fg-subtle': color.translucify(0.3).css(), textSubtle: color.translucify(0.3),
'--fg-subtler': color.css(), textSubtlest: color,
'--background': color.css(), surface: color,
'--background-highlight': color.lift(0.3).translucify(0.4).css(), border: color.lift(0.3).translucify(0.4),
'--background-highlight-secondary': color.translucify(0.9).css(), surfaceHighlight: color.translucify(0.9),
}; };
} }
function buttonSolidColorVariables(color: Color): CSSVariables { function buttonSolidColorVariables(
return { color: YaakColor,
'--fg': new Color('white', 'dark').css(), isDefault: boolean = false,
'--background': color.lower(0.15).css(), ): Partial<CSSVariables> {
'--background-highlight': color.css(), const theme: Partial<YaakTheme> = {
'--background-highlight-secondary': color.lower(0.3).css(), text: new YaakColor('white', 'dark'),
surface: color.lower(0.3),
surfaceHighlight: color.lower(0.1),
border: color,
}; };
if (isDefault) {
theme.text = color.lift(0.8);
theme.surface = undefined; // Inherit from root
theme.surfaceHighlight = color.lift(0.08);
}
return theme;
} }
function buttonBorderColorVariables(color: Color): CSSVariables { function buttonBorderColorVariables(
return { color: YaakColor,
'--fg': color.lift(0.6).css(), isDefault: boolean = false,
'--fg-subtle': color.lift(0.4).css(), ): Partial<CSSVariables> {
'--fg-subtler': color.lift(0.4).translucify(0.6).css(), const theme = {
'--background': Color.transparent().css(), text: color.lift(0.8),
'--background-highlight': color.translucify(0.8).css(), textSubtle: color.lift(0.55),
textSubtlest: color.lift(0.4).translucify(0.6),
surfaceHighlight: color.translucify(0.8),
borderSubtle: color.translucify(0.5),
border: color.translucify(0.3),
}; };
if (isDefault) {
theme.borderSubtle = color.lift(0.28);
theme.border = color.lift(0.5);
}
return theme;
} }
function variablesToCSS(selector: string | null, vars: CSSVariables | null): string | null { function variablesToCSS(
selector: string | null,
vars: Partial<CSSVariables> | null,
): string | null {
if (vars == null) { if (vars == null) {
return null; return null;
} }
const css = Object.entries(vars ?? {}) const css = Object.entries(vars ?? {})
.filter(([, value]) => value) .filter(([, value]) => value)
.map(([name, value]) => `${name}: ${value};`) .map(([name, value]) => `--${name}: ${value?.css()};`)
.join('\n'); .join('\n');
return selector == null ? css : `${selector} {\n${indent(css)}\n}`; return selector == null ? css : `${selector} {\n${indent(css)}\n}`;
@@ -150,41 +178,43 @@ function componentCSS(
return variablesToCSS(`.x-theme-${component}`, themeVars); return variablesToCSS(`.x-theme-${component}`, themeVars);
} }
function buttonCSS(color: ColorName, colors?: Partial<RootColors>): string | null { function buttonCSS(color: YaakColorKey, colors?: Partial<YaakColors>): string | null {
const cssColor = colors?.[color]; const yaakColor = colors?.[color];
if (cssColor == null) { if (yaakColor == null) {
return null; return null;
} }
return [ return [
variablesToCSS(`.x-theme-button--solid--${color}`, buttonSolidColorVariables(cssColor)), variablesToCSS(`.x-theme-button--solid--${color}`, buttonSolidColorVariables(yaakColor)),
variablesToCSS(`.x-theme-button--border--${color}`, buttonBorderColorVariables(cssColor)), variablesToCSS(`.x-theme-button--border--${color}`, buttonBorderColorVariables(yaakColor)),
].join('\n\n'); ].join('\n\n');
} }
function bannerCSS(color: ColorName, colors?: Partial<RootColors>): string | null { function bannerCSS(color: YaakColorKey, colors?: Partial<YaakColors>): string | null {
const cssColor = colors?.[color]; const yaakColor = colors?.[color];
if (cssColor == null) { if (yaakColor == null) {
return null; return null;
} }
return [variablesToCSS(`.x-theme-banner--${color}`, bannerColorVariables(cssColor))].join('\n\n'); return [variablesToCSS(`.x-theme-banner--${color}`, bannerColorVariables(yaakColor))].join(
'\n\n',
);
} }
function placeholderCSS(color: ColorName, colors?: Partial<RootColors>): string | null { function placeholderCSS(color: YaakColorKey, colors?: Partial<YaakColors>): string | null {
const cssColor = colors?.[color]; const yaakColor = colors?.[color];
if (cssColor == null) { if (yaakColor == null) {
return null; return null;
} }
return [ return [
variablesToCSS(`.x-theme-placeholder--${color}`, placeholderColorVariables(cssColor)), variablesToCSS(`.x-theme-placeholder--${color}`, placeholderColorVariables(yaakColor)),
].join('\n\n'); ].join('\n\n');
} }
export function isThemeDark(theme: ThemeComponent): boolean { export function isThemeDark(theme: Partial<YaakColors>): boolean {
if (theme.background && theme.foreground) { if (theme.surface && theme.text) {
return theme.foreground.lighterThan(theme.background); return theme.text.lighterThan(theme.surface);
} }
return false; return false;
@@ -193,35 +223,49 @@ export function isThemeDark(theme: ThemeComponent): boolean {
export function getThemeCSS(theme: YaakTheme): string { export function getThemeCSS(theme: YaakTheme): string {
theme.components = theme.components ?? {}; theme.components = theme.components ?? {};
// Toast defaults to menu styles // Toast defaults to menu styles
theme.components.toast = theme.components.toast ?? theme.components.menu; theme.components.toast = theme.components.toast ?? theme.components.menu ?? {};
const { components, id, name } = theme;
const colors = Object.keys(theme)
.filter((key) => theme[key as YaakColorKey] instanceof YaakColor)
.reduce((prev, key) => {
return { ...prev, [key]: theme[key as YaakColorKey] };
}, {});
let themeCSS = ''; let themeCSS = '';
try { try {
const baseCss = variablesToCSS(null, themeVariables(theme)); const baseCss = variablesToCSS(null, themeVariables(theme));
const { components, colors } = theme;
themeCSS = [ themeCSS = [
baseCss, baseCss,
...Object.keys(components ?? {}).map((key) => ...Object.keys(components ?? {}).map((key) =>
componentCSS(key as ComponentName, theme.components), componentCSS(key as ComponentName, theme.components),
), ),
...Object.keys(colors ?? {}).map((key) => variablesToCSS(
buttonCSS(key as ColorName, theme.components?.button?.colors ?? colors), `.x-theme-button--solid--default`,
buttonSolidColorVariables(theme.surface, true),
),
variablesToCSS(
`.x-theme-button--border--default`,
buttonBorderColorVariables(theme.surface, true),
), ),
...Object.keys(colors ?? {}).map((key) => ...Object.keys(colors ?? {}).map((key) =>
bannerCSS(key as ColorName, theme.components?.banner?.colors ?? colors), buttonCSS(key as YaakColorKey, theme.components?.button ?? colors),
), ),
...Object.keys(colors ?? {}).map((key) => ...Object.keys(colors ?? {}).map((key) =>
placeholderCSS(key as ColorName, theme.components?.placeholder?.colors ?? colors), bannerCSS(key as YaakColorKey, theme.components?.banner ?? colors),
),
...Object.keys(colors ?? {}).map((key) =>
placeholderCSS(key as YaakColorKey, theme.components?.placeholder ?? colors),
), ),
].join('\n\n'); ].join('\n\n');
} catch (err) { } catch (err) {
console.error(err); console.error('Failed to generate CSS', err);
} }
return [`/* ${theme.name} */`, `[data-theme="${theme.id}"] {`, indent(themeCSS), '}'].join('\n'); return [`/* ${name} */`, `[data-theme="${id}"] {`, indent(themeCSS), '}'].join('\n');
} }
export function addThemeStylesToDocument(theme: YaakTheme) { export function addThemeStylesToDocument(theme: YaakTheme) {
theme = completeTheme(theme);
let styleEl = document.head.querySelector(`style[data-theme]`); let styleEl = document.head.querySelector(`style[data-theme]`);
if (!styleEl) { if (!styleEl) {
styleEl = document.createElement('style'); styleEl = document.createElement('style');
@@ -229,6 +273,7 @@ export function addThemeStylesToDocument(theme: YaakTheme) {
} }
styleEl.setAttribute('data-theme', theme.id); styleEl.setAttribute('data-theme', theme.id);
styleEl.setAttribute('data-updated-at', new Date().toISOString());
styleEl.textContent = getThemeCSS(theme); styleEl.textContent = getThemeCSS(theme);
} }
@@ -242,3 +287,74 @@ export function indent(text: string, space = ' '): string {
.map((line) => space + line) .map((line) => space + line)
.join('\n'); .join('\n');
} }
export function completeTheme(theme: YaakTheme): YaakTheme {
const isDark = isThemeDark(theme);
// Clone the theme
theme = deserializeTheme(serializeTheme(theme), isDark ? 'dark' : 'light');
const base = isDark ? defaultDarkTheme : defaultLightTheme;
theme.primary = theme.primary ?? base.primary;
theme.secondary = theme.secondary ?? base.secondary;
theme.info = theme.info ?? base.info;
theme.success = theme.success ?? base.success;
theme.notice = theme.notice ?? base.notice;
theme.warning = theme.warning ?? base.warning;
theme.danger = theme.danger ?? base.danger;
theme.surface = theme.surface ?? base.surface;
theme.surfaceHighlight = theme.surfaceHighlight ?? theme.surface?.lift(0.06);
theme.surfaceActive = theme.surfaceActive ?? theme.primary?.lower(0.2).translucify(0.8);
theme.border = theme.border ?? theme.surface?.lift(0.12);
theme.borderSubtle = theme.borderSubtle ?? theme.border?.lower(0.08);
console.log('HELLO', { theme });
theme.text = theme.text ?? theme.border?.lift(1).lower(0.2);
theme.textSubtle = theme.textSubtle ?? theme.text?.lower(0.3);
theme.textSubtlest = theme.textSubtlest ?? theme.text?.lower(0.5);
return theme;
}
export function serializeTheme(theme: YaakTheme): string {
function next(o: Record<string, unknown>) {
o = { ...o }; // Clone first
for (const k of Object.keys(o)) {
const v = o[k];
if (v instanceof YaakColor) {
o[k] = v.css();
} else if (Object.prototype.toString.call(v) === '[object Object]') {
o[k] = next(v as Record<string, unknown>);
} else {
o[k] = v;
}
}
return o;
}
return JSON.stringify(next(theme));
}
export function deserializeTheme(theme: string, appearance: 'dark' | 'light'): YaakTheme {
function next(o: Record<string, unknown>) {
for (const k of Object.keys(o)) {
const v = o[k];
if (v instanceof YaakColor) {
o[k] = v;
} else if (typeof v === 'string' && v.match(/^(#|hsla\()/)) {
o[k] = new YaakColor(v, appearance);
} else if (Object.prototype.toString.call(v) === '[object Object]') {
o[k] = next(v as Record<string, unknown>);
} else {
o[k] = v;
}
}
return o;
}
return next(JSON.parse(theme)) as YaakTheme;
}

View File

@@ -0,0 +1,140 @@
import parseColor from 'parse-color';
export class YaakColor {
private readonly appearance: 'dark' | 'light' = 'light';
private hue: number = 0;
private saturation: number = 0;
private lightness: number = 0;
private alpha: number = 1;
constructor(cssColor: string, appearance: 'dark' | 'light' = 'light') {
try {
this.set(cssColor);
this.appearance = appearance;
} catch (err) {
console.log('Failed to parse CSS color', cssColor, err);
}
}
static transparent(): YaakColor {
return new YaakColor('rgb(0,0,0)', 'light').translucify(1);
}
static white(): YaakColor {
return new YaakColor('rgb(0,0,0)', 'light').lower(1);
}
static black(): YaakColor {
return new YaakColor('rgb(0,0,0)', 'light').lift(1);
}
set(cssColor: string): YaakColor {
if (cssColor.startsWith('#') && cssColor.length === 9) {
const [r, g, b, a] = hexToRgba(cssColor);
cssColor = `rgba(${r},${g},${b},${a})`;
}
const { hsla } = parseColor(cssColor);
this.hue = hsla[0];
this.saturation = hsla[1];
this.lightness = hsla[2];
this.alpha = hsla[3] ?? 1;
return this;
}
clone(): YaakColor {
return new YaakColor(this.css(), this.appearance);
}
lower(mod: number): YaakColor {
return this.appearance === 'dark' ? this._darken(mod) : this._lighten(mod);
}
lift(mod: number): YaakColor {
return this.appearance === 'dark' ? this._lighten(mod) : this._darken(mod);
}
minLightness(n: number): YaakColor {
const c = this.clone();
if (c.lightness < n) {
c.lightness = n;
}
return c;
}
isDark(): boolean {
return this.lightness < 50;
}
translucify(mod: number): YaakColor {
const c = this.clone();
c.alpha = c.alpha - c.alpha * mod;
return c;
}
opacify(mod: number): YaakColor {
const c = this.clone();
c.alpha = this.alpha + (100 - this.alpha) * mod;
return c;
}
desaturate(mod: number): YaakColor {
const c = this.clone();
c.saturation = c.saturation - c.saturation * mod;
return c;
}
saturate(mod: number): YaakColor {
const c = this.clone();
c.saturation = this.saturation + (100 - this.saturation) * mod;
return c;
}
lighterThan(c: YaakColor): boolean {
return this.lightness > c.lightness;
}
css(): string {
const h = this.hue;
const s = this.saturation;
const l = this.lightness;
const a = this.alpha; // Convert from 0-1 to 0-255
const [r, g, b] = parseColor(`hsl(${h},${s}%,${l}%)`).rgb;
return rgbaToHex(r, g, b, a);
}
private _lighten(mod: number): YaakColor {
const c = this.clone();
c.lightness = this.lightness + (100 - this.lightness) * mod;
return c;
}
private _darken(mod: number): YaakColor {
const c = this.clone();
c.lightness = this.lightness - this.lightness * mod;
return c;
}
}
function rgbaToHex(r: number, g: number, b: number, a: number): string {
const toHex = (n: number): string => {
const hex = Number(Math.round(n)).toString(16);
return hex.length === 1 ? `0${hex}` : hex;
};
return '#' + [toHex(r), toHex(g), toHex(b), toHex(a * 255)].join('').toUpperCase();
}
function hexToRgba(hex: string): [number, number, number, number] {
const fromHex = (h: string): number => {
if (h === '') return 255;
return Number(`0x${h}`);
};
const r = fromHex(hex.slice(1, 3));
const g = fromHex(hex.slice(3, 5));
const b = fromHex(hex.slice(5, 7));
const a = fromHex(hex.slice(7, 9));
return [r, g, b, a / 255];
}

View File

@@ -6,7 +6,7 @@
html, html,
body, body,
#root { #root {
@apply w-full h-full overflow-hidden text-fg bg-background; @apply w-full h-full overflow-hidden text-text bg-surface;
} }
* { * {
@@ -62,7 +62,7 @@
&:hover { &:hover {
&.scrollbar-thumb, &.scrollbar-thumb,
&::-webkit-scrollbar-thumb { &::-webkit-scrollbar-thumb {
@apply bg-background-highlight-secondary hover:bg-fg-subtler rounded-full; @apply bg-surface-highlight hover:bg-surface-highlight rounded-full;
} }
} }
} }
@@ -74,7 +74,7 @@
iframe { iframe {
&::-webkit-scrollbar-corner, &::-webkit-scrollbar-corner,
&::-webkit-scrollbar { &::-webkit-scrollbar {
@apply bg-background-highlight-secondary !important; @apply bg-surface-highlight !important;
} }
} }

View File

@@ -52,49 +52,55 @@ module.exports = {
'4xs': '0.6rem', '4xs': '0.6rem',
'3xs': '0.675rem', '3xs': '0.675rem',
'2xs': '0.75rem', '2xs': '0.75rem',
'xs': '0.8rem', xs: '0.8rem',
'sm': '0.9rem', sm: '0.9rem',
'base': '1rem', base: '1rem',
'xl': '1.25rem', xl: '1.25rem',
'2xl': '1.5rem', '2xl': '1.5rem',
'3xl': '2rem', '3xl': '2rem',
'4xl': '2.5rem', '4xl': '2.5rem',
'5xl': '3rem', '5xl': '3rem',
'editor': 'var(--editor-font-size)', editor: 'var(--editor-font-size)',
'shrink': '0.8em', shrink: '0.8em',
}, },
boxShadow: { boxShadow: {
DEFAULT: '0 1px 3px 0 var(--shadow);', DEFAULT: '0 1px 3px 0 var(--shadow);',
lg: '0 10px 15px -3px var(--shadow)', lg: '0 10px 15px -3px var(--shadow)',
}, },
colors: { colors: {
'transparent': 'transparent', transparent: 'transparent',
'placeholder': 'var(--fg-subtler)',
'selection': 'var(--background-selection)', // placeholder: 'var(--fg-subtler)', // Now a component?
shadow: 'var(--shadow)',
backdrop: 'var(--backdrop)',
selection: 'var(--selection)',
// New theme values // New theme values
'border-focus': 'var(--border-focus)', surface: 'var(--surface)',
'fg': 'var(--fg)', 'surface-highlight': 'var(--surfaceHighlight)',
'fg-danger': 'var(--fg-danger)', 'surface-active': 'var(--surfaceActive)',
'fg-subtle': 'var(--fg-subtle)',
'fg-subtler': 'var(--fg-subtler)', text: 'var(--text)',
'fg-primary': 'var(--fg-primary)', 'text-subtle': 'var(--textSubtle)',
'fg-secondary': 'var(--fg-secondary)', 'text-subtlest': 'var(--textSubtlest)',
'fg-success': 'var(--fg-success)',
'fg-info': 'var(--fg-info)', border: 'var(--border)',
'fg-notice': 'var(--fg-notice)', 'border-subtle': 'var(--borderSubtle)',
'fg-warning': 'var(--fg-warning)', 'border-focus': 'var(--borderFocus)',
'background': 'var(--background)',
'background-active': 'var(--background-active)', primary: 'var(--primary)',
'background-highlight': 'var(--background-highlight)', danger: 'var(--danger)',
'background-highlight-secondary': 'var(--background-highlight-secondary)', secondary: 'var(--secondary)',
'background-backdrop': 'var(--background-backdrop)', success: 'var(--success)',
info: 'var(--info)',
notice: 'var(--notice)',
warning: 'var(--warning)',
}, },
}, },
plugins: [ plugins: [
require('@tailwindcss/container-queries'), require('@tailwindcss/container-queries'),
plugin(function ({addVariant}) { plugin(function ({ addVariant }) {
addVariant('hocus', ['&:hover', '&:focus-visible', '&.focus:focus']); addVariant('hocus', ['&:hover', '&:focus-visible', '&.focus:focus']);
addVariant('focus-visible-or-class', ['&:focus-visible', '&.focus:focus']); addVariant('focus-visible-or-class', ['&:focus-visible', '&.focus:focus']);
}), }),

View File

@@ -20,7 +20,8 @@
"include": [ "include": [
"src-web", "src-web",
"src-web/modules.d.ts", "src-web/modules.d.ts",
"vite.config.ts" "vite.config.ts",
"tailwind.config.cjs"
], ],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]
} }