code editor bg

This commit is contained in:
Mathew Pareles 2025-01-03 01:31:47 -08:00
parent 2519f094cc
commit 01d7878671
5 changed files with 23 additions and 11 deletions

View file

@ -69,7 +69,7 @@ export const BlockCode = ({ text, buttonsOnHover, language }: { text: string, bu
const isSingleLine = !text.includes('\n')
return (<>
<div className={`relative group w-full bg-void-bg-3 overflow-hidden isolate`}>
<div className={`relative group w-full overflow-hidden`}>
{buttonsOnHover === null ? null : (
<div className="z-[1] absolute top-0 right-0 opacity-0 group-hover:opacity-100 duration-200">
<div className={`flex space-x-2 ${isSingleLine ? '' : 'p-2'}`}>{buttonsOnHover}</div>

View file

@ -49,14 +49,14 @@ const CodeButtonsOnHover = ({ text }: { text: string }) => {
return <>
<button
className={`${isSingleLine ? '' : 'p-1'} text-xs bg-void-bg-1 text-void-fg-3 hover:brightness-110 border border-vscode-input-border rounded text-xs`}
className={`${isSingleLine ? '' : 'p-1'} text-xs bg-void-bg-1 text-void-fg-1 hover:brightness-110 border border-vscode-input-border rounded text-xs`}
onClick={onCopy}
>
{copyButtonState}
</button>
<button
// btn btn-secondary btn-sm border text-xs border-vscode-input-border rounded
className={`${isSingleLine ? '' : 'p-1'} text-xs bg-void-bg-1 hover:brightness-110 border border-vscode-input-border rounded text-xs`}
className={`${isSingleLine ? '' : 'p-1'} text-xs bg-void-bg-1 text-void-fg-1 hover:brightness-110 border border-vscode-input-border rounded text-xs`}
onClick={onApply}
>
Apply

View file

@ -285,12 +285,12 @@ export const SelectedFiles = (
{/* selection summary */}
<div
// className="relative rounded rounded-e-2xl flex items-center space-x-2 mx-1 mb-1 disabled:cursor-default"
className={`flex items-center gap-1 relative
rounded-md p-1
className={`flex items-center gap-0.5 relative
rounded-md px-1
w-fit h-fit
select-none
bg-void-bg-3 hover:brightness-95
text-void-fg-3 text-xs text-nowrap
text-void-fg-1 text-xs text-nowrap
border border-vscode-commandcenter-border rounded-xs
`}
onClick={() => {
@ -347,7 +347,7 @@ export const SelectedFiles = (
</div>
{/* selection text */}
{isThisSelectionOpened &&
<div className='w-full p-1 rounded-sm border-vscode-editor-border'>
<div className='w-full px-1 rounded-sm border-vscode-editor-border'>
<BlockCode text={selection.selectionStr!} language={getLanguageFromFileName(selection.fileURI.path)} />
</div>
}

View file

@ -20,6 +20,17 @@
.inherit-bg-all-restyle > * {
background-color: inherit !important;
}
/* redefine sidebar background to editor background */
.my-code-editor {
--vscode-sideBar-background: var(--vscode-editor-background);
}
/* html {
font-size: var(--vscode-font-size);

View file

@ -303,14 +303,15 @@ export const VoidCodeEditor = ({ initValue, language }: { initValue: string, lan
const instantiationService = accessor.get('IInstantiationService')
const modelService = accessor.get('IModelService')
const languageDetectionService = accessor.get('ILanguageDetectionService')
const themeService = accessor.get('IThemeService')
initValue = normalizeIndentation(initValue)
return <div ref={divRef}>
<WidgetComponent
className='relative z-0 bg-void-bg-3' // text-sm
ctor={useCallback((container) =>
instantiationService.createInstance(
className='relative z-0 bg-red-500 @@my-code-editor' // text-sm
ctor={useCallback((container) => {
return instantiationService.createInstance(
CodeEditorWidget,
container,
{
@ -354,7 +355,7 @@ export const VoidCodeEditor = ({ initValue, language }: { initValue: string, lan
{
isSimpleWidget: true,
})
, [instantiationService])
}, [instantiationService])
}
onCreateInstance={useCallback((editor: CodeEditorWidget) => {