Skip to content

Commit

Permalink
Support Dark Mode for Text Viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
itaigilo committed Nov 14, 2024
1 parent 338f4d0 commit db4539d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC } from "react";
import React, { FC, useContext } from "react";
import Alert from "react-bootstrap/Alert";
import { humanSize } from "../../../../lib/components/repository/tree";
import { useAPI } from "../../../../lib/hooks/api";
Expand All @@ -16,6 +16,8 @@ import {

import "react-ipynb-renderer/dist/styles/default.css";
import { useMarkdownProcessor } from "./useMarkdownProcessor";
import { AppContext } from "../../../../lib/hooks/appContext";
import { dark } from "react-syntax-highlighter/dist/esm/styles/prism";

export const ObjectTooLarge: FC<RendererComponent> = ({ path, sizeBytes }) => {
return (
Expand Down Expand Up @@ -81,10 +83,12 @@ export const TextRenderer: FC<RendererComponentWithText> = ({
fileExtension,
text,
}) => {
const {state} = useContext(AppContext);
const language = guessLanguage(fileExtension, contentType) ?? "plaintext";

return (
<SyntaxHighlighter
style={syntaxHighlightStyle}
style={state.settings.darkMode ? dark : syntaxHighlightStyle}
language={language}
showInlineLineNumbers={true}
showLineNumbers={true}
Expand Down

0 comments on commit db4539d

Please sign in to comment.