Skip to content

Commit

Permalink
feat: Invert brightness of SVG in dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
huyenngn authored and Wuestengecko committed Sep 30, 2024
1 parent ad9ea6a commit 6c56a48
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@
.read-the-docs {
color: #888;
}

html.dark .svg-display {
filter: invert() invert(19%) sepia(9%) saturate(1857%) hue-rotate(180deg)
brightness(99%) contrast(87%);
}

html.dark .header-button *,
html.dark .icon * {
filter: invert() hue-rotate(180deg);
}
2 changes: 1 addition & 1 deletion frontend/src/components/InstanceView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const InstanceView = ({ templateName, objectID, endpoint }) => {
<div className="fixed hidden md:-ml-14 md:-mt-6 md:block">
<div
onClick={() => window.print()}
className="flex cursor-pointer items-center justify-center
className="icon flex cursor-pointer items-center justify-center
rounded-full bg-custom-blue p-2 text-white transition-colors
duration-700 ease-in-out hover:bg-custom-dark-4
dark:bg-custom-blue dark:text-gray-100
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/Lightbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const Lightbox = ({ onClose, imageSource }) => {
<XIcon />
</LightboxButton>
</div>
<div className="mt-2 flex h-full w-full overflow-visible pt-16">
<div
className="svg-display mt-2 flex h-full w-full overflow-visible pt-16">
{imageSource && (
<TransformWrapper wheel={{ smoothStep: 0.005 }}>
<TransformComponent>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/SVGDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const SVGDisplay = ({ content }) => {
return (
<>
<div
className="group relative"
className="svg-display group relative"
style={{ maxWidth: '100%', height: 'auto' }}
onClick={handleSvgClick}>
<div
Expand Down

0 comments on commit 6c56a48

Please sign in to comment.