New source found from dndbeyond.com
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import clsx from "clsx";
|
||||
import { FC } from "react";
|
||||
import Color from "color";
|
||||
import { CSSProperties, FC } from "react";
|
||||
|
||||
import {
|
||||
Button as TtuiButton,
|
||||
@@ -33,7 +34,14 @@ export const Button: FC<ButtonProps> = ({
|
||||
const isCustomSize = size === "xx-small";
|
||||
const isCustomVariant = variant === "builder" || variant === "builder-text";
|
||||
const isCustomColor = color === "builder-green";
|
||||
const { isDarkMode } = useCharacterTheme();
|
||||
const { isDarkMode, themeColor } = useCharacterTheme();
|
||||
let overrideStyles: CSSProperties = {};
|
||||
if (isDarkMode && themed && variant === "solid" && size === "xx-small") {
|
||||
overrideStyles = {
|
||||
// Determine if the theme color is darker or lighter
|
||||
color: Color(themeColor).isDark() ? "" : "black",
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<TtuiButton
|
||||
@@ -53,6 +61,7 @@ export const Button: FC<ButtonProps> = ({
|
||||
variant={!isCustomVariant ? variant : undefined}
|
||||
// Children are included in props
|
||||
color={!isCustomColor ? color : undefined}
|
||||
style={overrideStyles}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user