Skip to content

Commit

Permalink
Make boxes readable in dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
lynn committed Sep 5, 2023
1 parent 12c3892 commit 6993c4b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/web/Boxes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReactElement, useState, useEffect, ReactNode } from 'react';
import { BoxClause, BoxSentence, PostField } from '../boxes';
import './Boxes.css';
import { useDarkMode } from 'usehooks-ts';

interface BoxProps {
color: string;
Expand All @@ -9,13 +10,14 @@ interface BoxProps {
}

function Box(props: BoxProps) {
const darkMode = useDarkMode();
const { color, label, children } = props;
const other = darkMode.isDarkMode ? '#444 80%' : 'white 80%';
return (
<div
className="boxes-box"
style={{
// border: `2px solid ${color}`,
background: `color-mix(in srgb, ${color}, white 80%)`,
background: `color-mix(in srgb, ${color}, ${other})`,
}}
>
<div className="boxes-label">{label}</div>
Expand Down

0 comments on commit 6993c4b

Please sign in to comment.