aboutsummaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/components/ColorPicker/HotkeyLabel.tsx
blob: 145060d195c5859f007262651e428bc9dd45e331 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from "react";
import { getContrastYIQ } from "./colorPickerUtils";

interface HotkeyLabelProps {
  color: string;
  keyLabel: string | number;
  isCustomColor?: boolean;
  isShade?: boolean;
}
const HotkeyLabel = ({
  color,
  keyLabel,
  isCustomColor = false,
  isShade = false,
}: HotkeyLabelProps) => {
  return (
    <div
      className="color-picker__button__hotkey-label"
      style={{
        color: getContrastYIQ(color, isCustomColor),
      }}
    >
      {isShade && "⇧"}
      {keyLabel}
    </div>
  );
};

export default HotkeyLabel;