💄 closer match to vscode color scheme

This commit is contained in:
Nate Sesti 2024-01-17 21:05:40 -08:00
parent bc1efe90a3
commit 63ed4d5f91
19 changed files with 115 additions and 84 deletions

View file

@ -10,9 +10,9 @@ import { Outlet, useLocation, useNavigate } from "react-router-dom";
import styled from "styled-components";
import {
defaultBorderRadius,
secondaryDark,
vscBackground,
vscForeground,
vscInputBackground,
} from ".";
import { defaultModelSelector } from "../redux/selectors/modelSelectors";
import {
@ -61,7 +61,7 @@ const BottomMessageDiv = styled.div<{ displayOnBottom: boolean }>`
right: 0;
margin: 8px;
margin-top: 0;
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
color: ${vscForeground};
border-radius: ${defaultBorderRadius};
padding: 12px;
@ -93,7 +93,7 @@ const GridDiv = styled.div`
`;
const DropdownPortalDiv = styled.div`
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
position: relative;
margin-left: 8px;
z-index: 200;

View file

@ -2,8 +2,8 @@ import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
secondaryDark,
vscForeground,
vscInputBackground,
} from "..";
import { getFontSize } from "../../util";
@ -17,7 +17,7 @@ const Div = styled.div<{ fontSize?: number }>`
margin: 8px auto;
height: auto;
width: 100%;
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
color: ${vscForeground};
z-index: 1;
border: 1px solid transparent;

View file

@ -4,9 +4,9 @@ import styled from "styled-components";
import {
Button,
defaultBorderRadius,
secondaryDark,
vscBackground,
vscForeground,
vscInputBackground,
} from "..";
import {
setDialogMessage,
@ -36,7 +36,7 @@ const ContextGroupSelectDiv = styled.div`
gap: 8px;
padding: 8px;
border-radius: ${defaultBorderRadius};
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
color: ${vscForeground};
margin-top: 8px;
cursor: pointer;

View file

@ -1,7 +1,7 @@
import React, { isValidElement, useEffect } from "react";
import styled from "styled-components";
import { secondaryDark, vscBackground, vscForeground } from "..";
import { ReactMarkdown } from "react-markdown/lib/react-markdown";
import styled from "styled-components";
import { vscBackground, vscForeground, vscInputBackground } from "..";
const ScreenCover = styled.div`
position: fixed;
@ -37,7 +37,7 @@ const TextArea = styled.textarea`
padding: 8px;
outline: 1px solid black;
resize: none;
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
color: ${vscForeground};
&:focus {

View file

@ -9,8 +9,8 @@ import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
secondaryDark,
vscBackground,
vscInputBackground,
} from "..";
import { RootStore } from "../../redux/store";
import { getFontSize } from "../../util";
@ -50,7 +50,7 @@ const ContentDiv = styled.div<{ isUserInput: boolean; fontSize?: number }>`
padding: 2px;
padding-right: 0px;
background-color: ${(props) =>
props.isUserInput ? secondaryDark : vscBackground};
props.isUserInput ? vscInputBackground : vscBackground};
font-size: ${(props) => props.fontSize || getFontSize()}px;
border-radius: ${defaultBorderRadius};
overflow: hidden;

View file

@ -3,31 +3,49 @@ import styled, { keyframes } from "styled-components";
import { getFontSize } from "../util";
import { isJetBrains } from "../util/ide";
export const VSC_SECONDARY_DARK_VAR = "--vscode-input-background";
export const VSC_INPUT_BACKGROUND_VAR = "--vscode-input-background";
export const VSC_BACKGROUND_VAR = "--vscode-sideBar-background";
export const VSC_FOREGROUND_VAR = "--vscode-editor-foreground";
export const VSC_BUTTON_BACKGROUND_VAR = "--vscode-button-background";
export const VSC_EDITOR_BACKGROUND_VAR = "--vscode-editor-background";
export const VSC_LIST_SELECTION_BACKGROUND_VAR =
"--vscode-list-activeSelectionBackground";
export const VSC_FOCUS_BORDER = "--vscode-focus-border";
export const VSC_LIST_ACTIVE_FOREGROUND_VAR =
"--vscode-quickInputList-focusForeground";
export const VSC_QUICK_INPUT_BACKGROUND_VAR = "--vscode-quickInput-background";
export const VSC_INPUT_BORDER_VAR = "--vscode-input-border";
export const VSC_INPUT_BORDER_FOCUS_VAR = "--vscode-focusBorder";
export const VSC_THEME_COLOR_VARS = [
VSC_SECONDARY_DARK_VAR,
VSC_INPUT_BACKGROUND_VAR,
VSC_BACKGROUND_VAR,
VSC_FOREGROUND_VAR,
VSC_BUTTON_BACKGROUND_VAR,
VSC_EDITOR_BACKGROUND_VAR,
VSC_LIST_SELECTION_BACKGROUND_VAR,
VSC_FOCUS_BORDER,
VSC_LIST_ACTIVE_FOREGROUND_VAR,
VSC_QUICK_INPUT_BACKGROUND_VAR,
VSC_INPUT_BORDER_VAR,
VSC_INPUT_BORDER_FOCUS_VAR,
];
export const defaultBorderRadius = "5px";
export const lightGray = "#646464";
export const buttonColor = "#1bbe84";
export const buttonColorHover = "#1bbe84a8";
export const greenButtonColor = "#1bbe84";
export const secondaryDark = `var(${VSC_SECONDARY_DARK_VAR}, rgb(45 45 45))`;
// export const vscBackground = "var(--vscode-editor-background, rgb(30 30 30))";
export const vscInputBackground = `var(${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`;
export const vscQuickInputBackground = `var(${VSC_QUICK_INPUT_BACKGROUND_VAR}, ${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`;
export const vscBackground = `var(${VSC_BACKGROUND_VAR}, rgb(30 30 30))`;
export const vscForeground = `var(${VSC_FOREGROUND_VAR}, #fff)`;
export const vscButtonBackground = `var(${VSC_BUTTON_BACKGROUND_VAR}, #1bbe84)`;
export const vscEditorBackground = `var(${VSC_EDITOR_BACKGROUND_VAR}, ${VSC_BACKGROUND_VAR}, rgb(30 30 30))`;
export const vscListActiveBackground = `var(${VSC_LIST_SELECTION_BACKGROUND_VAR}, #1bbe84)`;
export const vscFocusBorder = `var(${VSC_FOCUS_BORDER}, #1bbe84)`;
export const vscListActiveForeground = `var(${VSC_LIST_ACTIVE_FOREGROUND_VAR}, ${VSC_FOREGROUND_VAR})`;
export const vscInputBorder = `var(${VSC_INPUT_BORDER_VAR}, ${lightGray})`;
export const vscInputBorderFocus = `var(${VSC_INPUT_BORDER_FOCUS_VAR}, ${lightGray})`;
if (typeof document !== "undefined") {
for (const colorVar of VSC_THEME_COLOR_VARS) {
@ -55,7 +73,7 @@ export const Button = styled.button`
border: none;
color: white;
background-color: ${buttonColor};
background-color: ${vscListActiveBackground};
&:disabled {
color: gray;
@ -85,7 +103,7 @@ export const TextArea = styled.textarea`
margin: 16px auto;
height: auto;
width: calc(100% - 32px);
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
color: ${vscForeground};
z-index: 1;
border: 1px solid transparent;
@ -120,7 +138,7 @@ export const Pre = styled.pre`
`;
export const H3 = styled.h3`
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
border-radius: ${defaultBorderRadius};
padding: 4px 8px;
width: fit-content;
@ -138,7 +156,7 @@ export const Input = styled.input`
color: ${vscForeground};
&:focus {
background: ${secondaryDark};
background: ${vscInputBackground};
}
&:invalid {
@ -157,7 +175,7 @@ export const NumberInput = styled.input.attrs({ type: "number" })`
color: ${vscForeground};
&:focus {
background: ${secondaryDark};
background: ${vscInputBackground};
}
`;
@ -242,7 +260,7 @@ export const HeaderButton = styled.button<{ inverted: boolean | undefined }>`
&:hover {
background-color: ${({ inverted }) =>
typeof inverted === "undefined" || inverted
? secondaryDark
? vscInputBackground
: "transparent"};
}
display: flex;

View file

@ -2,7 +2,7 @@ import { mergeAttributes, Node } from "@tiptap/core";
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
import { ContextItemWithId } from "core";
import { useDispatch, useSelector } from "react-redux";
import { buttonColor } from "..";
import { vscFocusBorder } from "..";
import { setEditingContextItemAtIndex } from "../../redux/slices/stateSlice";
import { RootStore } from "../../redux/store";
import CodeSnippetPreview from "../markdown/CodeSnippetPreview";
@ -27,7 +27,7 @@ const CodeBlockComponent = ({
item.id === contextItems[0]?.id
? "#d0d"
: selected
? buttonColor
? vscFocusBorder
: undefined
}
item={item}

View file

@ -1,5 +1,5 @@
import styled from "styled-components";
import { defaultBorderRadius, lightGray, secondaryDark } from "..";
import { defaultBorderRadius, lightGray, vscInputBackground } from "..";
const StyledDiv = styled.div<{ hidden?: boolean }>`
position: absolute;
@ -8,7 +8,7 @@ const StyledDiv = styled.div<{ hidden?: boolean }>`
right: 4px;
bottom: 4px;
width: calc(100% - 10px);
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
${(props) => (props.hidden ? "display: none;" : "")}

View file

@ -28,11 +28,12 @@ import {
} from "react";
import styled from "styled-components";
import {
buttonColor,
defaultBorderRadius,
lightGray,
secondaryDark,
vscForeground,
vscListActiveBackground,
vscListActiveForeground,
vscQuickInputBackground,
} from "..";
import FileIcon from "../FileIcon";
import { ComboBoxItem, ComboBoxItemType } from "./types";
@ -89,7 +90,7 @@ const ItemsDiv = styled.div`
padding: 0.2rem;
position: relative;
background-color: ${secondaryDark};
background-color: ${vscQuickInputBackground};
/* backdrop-filter: blur(12px); */
`;
@ -106,7 +107,8 @@ const ItemDiv = styled.div`
cursor: pointer;
&.is-selected {
background-color: ${buttonColor}33;
background-color: ${vscListActiveBackground};
color: ${vscListActiveForeground};
}
`;
@ -292,7 +294,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
</div>
<span
style={{
color: vscForeground,
color: vscListActiveForeground,
float: "right",
textAlign: "right",
opacity: index !== selectedIndex ? 0 : 1,

View file

@ -1,16 +1,16 @@
.mention {
background-color: #bfe2b6;
background-color: var(--vscode-badge-background, #bfe2b6);
color: var(--vscode-badge-foreground, --vscode-foreground, #000);
border-radius: 3px;
color: #000;
font-size: 0.9em;
padding: 0.05em 0.15em;
transition: background-color 0.2s ease-in-out;
}
.command-suggestion {
background-color: #bfe2b6;
background-color: var(--vscode-badge-background, #bfe2b6);
color: var(--vscode-badge-foreground, --vscode-foreground, #000);
border-radius: 3px;
color: #000;
font-size: 0.9em;
padding: 0.05em 0.15em;
transition: background-color 0.2s ease-in-out;

View file

@ -12,8 +12,10 @@ import styled from "styled-components";
import {
defaultBorderRadius,
lightGray,
secondaryDark,
vscForeground,
vscInputBackground,
vscInputBorder,
vscInputBorderFocus,
} from "..";
import { FilesSearchContext, FoldersSearchContext } from "../../App";
import useHistory from "../../hooks/useHistory";
@ -40,15 +42,16 @@ const InputBoxDiv = styled.div`
margin: 0;
height: auto;
width: calc(100% - 18px);
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
color: ${vscForeground};
z-index: 1;
border: 0.5px solid ${lightGray};
border: 0.5px solid ${vscInputBorder};
outline: none;
font-size: 14px;
&:focus {
outline: none;
border: 0.5px solid ${vscInputBorderFocus};
}
&::placeholder {

View file

@ -1,13 +1,13 @@
import { useEffect, useState } from "react";
import styled from "styled-components";
import { defaultBorderRadius, secondaryDark } from "..";
import { defaultBorderRadius, vscInputBackground } from "..";
import { postToIde } from "../../util/ide";
const StyledCode = styled.code<{ link: boolean }>`
color: ${(props) => (props.link ? "#ff4343" : "#f78383")};
word-wrap: break-word;
border-radius: ${defaultBorderRadius};
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
${(props) => props.link && "cursor: pointer;"}
&:hover {

View file

@ -1,7 +1,12 @@
import { BookOpenIcon } from "@heroicons/react/24/outline";
import React, { useEffect, useState } from "react";
import styled from "styled-components";
import { buttonColor, defaultBorderRadius, lightGray } from "..";
import {
defaultBorderRadius,
greenButtonColor,
lightGray,
vscFocusBorder,
} from "..";
import {
MODEL_PROVIDER_TAG_COLORS,
PROVIDER_INFO,
@ -56,13 +61,13 @@ const DimensionOptionDiv = styled.div<{ selected: boolean }>`
${(props) =>
props.selected &&
`
background-color: ${buttonColor};
background-color: ${greenButtonColor};
color: white;
`}
&:hover {
cursor: pointer;
outline: 1px solid ${buttonColor};
outline: 1px solid ${vscFocusBorder};
}
`;
@ -104,7 +109,7 @@ function ModelCard(props: ModelCardProps) {
return (
<Div
disabled={props.disabled || false}
color={buttonColor}
color={greenButtonColor}
hovered={hovered}
>
<div
@ -223,7 +228,7 @@ function ModelCard(props: ModelCardProps) {
(i === 0 &&
typeof selectedProvider === "undefined") ||
selectedProvider === option
? buttonColor + "aa"
? greenButtonColor + "aa"
: undefined,
}}
onClick={() => {

View file

@ -10,12 +10,13 @@ import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import {
buttonColor,
defaultBorderRadius,
lightGray,
secondaryDark,
vscBackground,
vscForeground,
vscInputBackground,
vscListActiveBackground,
vscListActiveForeground,
} from "..";
import { defaultModelSelector } from "../../redux/selectors/modelSelectors";
import { setDefaultModel } from "../../redux/slices/stateSlice";
@ -47,7 +48,7 @@ const Select = styled.select`
outline: none;
}
&:hover {
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
}
`;
@ -60,7 +61,7 @@ const StyledPlusIcon = styled(PlusIcon)`
height: 100%;
&:hover {
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
}
border-left: 0.5px solid ${lightGray};
`;
@ -73,7 +74,7 @@ const NewProviderDiv = styled.div`
border-top: 0.5px solid ${lightGray};
&:hover {
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
}
`;
@ -109,12 +110,12 @@ const StyledListboxButton = styled(Listbox.Button)`
}
&:hover {
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
}
`;
const StyledListboxOptions = styled(Listbox.Options)`
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
padding: 0;
position: absolute;
@ -127,12 +128,13 @@ const StyledListboxOptions = styled(Listbox.Options)`
const StyledListboxOption = styled(Listbox.Option)<{ selected: boolean }>`
background-color: ${({ selected }) =>
selected ? `${buttonColor}88` : secondaryDark};
selected ? vscListActiveBackground : vscInputBackground};
cursor: pointer;
padding: 6px 8px;
&:hover {
background-color: ${buttonColor}44;
background-color: ${vscListActiveBackground};
color: ${vscListActiveForeground};
}
`;
@ -175,7 +177,7 @@ function ListBoxOption({
e.stopPropagation();
e.preventDefault();
}}
style={{ backgroundColor: secondaryDark }}
style={{ backgroundColor: vscInputBackground }}
className="absolute right-0 p-1"
>
<TrashIcon width="1.2em" height="1.2em" />

View file

@ -1,6 +1,11 @@
import React from "react";
import styled from "styled-components";
import { buttonColor, defaultBorderRadius, lightGray, secondaryDark } from "..";
import {
defaultBorderRadius,
lightGray,
vscInputBackground,
vscListActiveBackground,
vscListActiveForeground,
} from "..";
const TopDiv = styled.div`
display: flex;
@ -12,7 +17,7 @@ const TopDiv = styled.div`
border: 1px solid ${lightGray};
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
border-radius: ${defaultBorderRadius};
&:hover {
@ -30,8 +35,9 @@ const SubDiv = styled.div<{ selected: boolean }>`
${(props) =>
props.selected &&
`
background-color: ${buttonColor}77;
background-color: ${vscListActiveBackground};
box-shadow: 0px 0px 8px 0px ${lightGray}88;
color: ${vscListActiveForeground};
`}
`;

View file

@ -1,13 +1,8 @@
import { useNavigate } from "react-router-dom";
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts";
import {
buttonColor,
lightGray,
vscBackground,
vscForeground,
} from "../components";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { lightGray, vscBackground, vscForeground } from "../components";
import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts";
const IconDiv = styled.div<{ backgroundColor?: string }>`
display: flex;
@ -60,7 +55,7 @@ function HelpPage() {
</svg>
</a>
</IconDiv>
<IconDiv backgroundColor={buttonColor}>
<IconDiv backgroundColor={"#1bbe84a8"}>
<a
href="https://continue.dev/docs/how-to-use-continue"
target="_blank"

View file

@ -4,7 +4,7 @@ import React, { Fragment, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import styled from "styled-components";
import { lightGray, secondaryDark, vscBackground } from "../components";
import { lightGray, vscBackground, vscInputBackground } from "../components";
import HeaderButtonWithText from "../components/HeaderButtonWithText";
import useHistory from "../hooks/useHistory";
import { newSession } from "../redux/slices/stateSlice";
@ -12,13 +12,13 @@ import { getFontSize } from "../util";
const Tr = styled.tr`
&:hover {
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
}
overflow-wrap: anywhere;
border-bottom: 1px solid ${secondaryDark};
border-top: 1px solid ${secondaryDark};
border-bottom: 1px solid ${vscInputBackground};
border-top: 1px solid ${vscInputBackground};
`;
const parseDate = (date: string): Date => {
@ -33,7 +33,7 @@ const SectionHeader = styled.tr`
padding: 4px;
padding-left: 16px;
padding-right: 16px;
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
width: 100%;
font-weight: bold;
text-align: center;

View file

@ -1,10 +1,10 @@
import React, { useEffect } from "react";
import Editor, { DiffEditor } from "@monaco-editor/react";
import { postToIde } from "../util/ide";
import { v4 } from "uuid";
import { secondaryDark } from "../components";
import HeaderButtonWithText from "../components/HeaderButtonWithText";
import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline";
import { DiffEditor } from "@monaco-editor/react";
import React, { useEffect } from "react";
import { v4 } from "uuid";
import { vscInputBackground } from "../components";
import HeaderButtonWithText from "../components/HeaderButtonWithText";
import { postToIde } from "../util/ide";
interface EditorFrameProps {
filename: string;
@ -40,7 +40,7 @@ function EditorFrame(props: EditorFrameProps) {
<div
className="my-2 px-2 py-1 flex justify-between items-center"
style={{
backgroundColor: secondaryDark,
backgroundColor: vscInputBackground,
}}
>
<code

View file

@ -10,9 +10,9 @@ import {
NumberInput,
TextArea,
lightGray,
secondaryDark,
vscBackground,
vscForeground,
vscInputBackground,
} from "../components";
import InfoHover from "../components/InfoHover";
import Loader from "../components/loaders/Loader";
@ -43,7 +43,7 @@ const SaveButton = styled(Button)`
const Slider = styled.input.attrs({ type: "range" })`
--webkit-appearance: none;
width: 100%;
background-color: ${secondaryDark};
background-color: ${vscInputBackground};
outline: none;
border: none;
opacity: 0.7;