adjust styles to better support light theme

This commit is contained in:
jeffvli 2025-06-25 19:44:28 -07:00
parent ac0c396712
commit 8f585a5be9
8 changed files with 66 additions and 30 deletions

View file

@ -37,8 +37,8 @@
} }
.main { .main {
border-radius: 50%;
background: var(--theme-colors-foreground) !important; background: var(--theme-colors-foreground) !important;
border-radius: 50%;
svg { svg {
display: flex; display: flex;

View file

@ -15,7 +15,7 @@ interface PlayerButtonProps extends Omit<ActionIconProps, 'icon' | 'variant'> {
} }
export const PlayerButton = forwardRef<HTMLButtonElement, PlayerButtonProps>( export const PlayerButton = forwardRef<HTMLButtonElement, PlayerButtonProps>(
({ icon, isActive, tooltip, variant, ...rest }: PlayerButtonProps) => { ({ icon, isActive, tooltip, variant, ...rest }: PlayerButtonProps, ref) => {
if (tooltip) { if (tooltip) {
return ( return (
<Tooltip {...tooltip}> <Tooltip {...tooltip}>
@ -23,6 +23,7 @@ export const PlayerButton = forwardRef<HTMLButtonElement, PlayerButtonProps>(
className={clsx({ className={clsx({
[styles.active]: isActive, [styles.active]: isActive,
})} })}
ref={ref}
{...rest} {...rest}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -41,6 +42,7 @@ export const PlayerButton = forwardRef<HTMLButtonElement, PlayerButtonProps>(
className={clsx(styles.playerButton, styles[variant], { className={clsx(styles.playerButton, styles[variant], {
[styles.active]: isActive, [styles.active]: isActive,
})} })}
ref={ref}
{...rest} {...rest}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -58,7 +60,8 @@ interface PlayButtonProps extends Omit<ActionIconProps, 'icon' | 'variant'> {
isPaused?: boolean; isPaused?: boolean;
} }
export const PlayButton = ({ isPaused, ...props }: PlayButtonProps) => { export const PlayButton = forwardRef<HTMLButtonElement, PlayButtonProps>(
({ isPaused, ...props }: PlayButtonProps, ref) => {
return ( return (
<ActionIcon <ActionIcon
className={styles.main} className={styles.main}
@ -66,6 +69,7 @@ export const PlayButton = ({ isPaused, ...props }: PlayButtonProps) => {
iconProps={{ iconProps={{
size: 'lg', size: 'lg',
}} }}
ref={ref}
tooltip={{ tooltip={{
label: isPaused label: isPaused
? (t('player.play', { postProcess: 'sentenceCase' }) as string) ? (t('player.play', { postProcess: 'sentenceCase' }) as string)
@ -74,4 +78,5 @@ export const PlayButton = ({ isPaused, ...props }: PlayButtonProps) => {
{...props} {...props}
/> />
); );
}; },
);

View file

@ -14,8 +14,7 @@ export const PlayButton = ({ className, ...props }: PlayButtonProps) => {
className={clsx(styles.button, className)} className={clsx(styles.button, className)}
icon="mediaPlay" icon="mediaPlay"
iconProps={{ iconProps={{
fill: 'default', size: 'xl',
size: 'lg',
}} }}
variant="filled" variant="filled"
{...props} {...props}

View file

@ -53,6 +53,11 @@
&:focus-visible { &:focus-visible {
background: darken(var(--theme-colors-primary-filled), 10%); background: darken(var(--theme-colors-primary-filled), 10%);
} }
svg {
color: var(--theme-colors-primary-contrast);
fill: var(--theme-colors-primary-contrast);
}
} }
&[data-variant='subtle'] { &[data-variant='subtle'] {
@ -60,8 +65,15 @@
background: transparent; background: transparent;
&:hover, &:hover,
&:active,
&:focus-visible { &:focus-visible {
background: lighten(var(--theme-colors-surface), 10%); @mixin dark {
background: lighten(var(--theme-colors-background), 5%);
}
@mixin light {
background: darken(var(--theme-colors-background), 5%);
}
} }
} }

View file

@ -92,7 +92,13 @@
&:hover, &:hover,
&:active, &:active,
&:focus-visible { &:focus-visible {
background-color: lighten(var(--button-bg), 10%); @mixin dark {
background-color: lighten(var(--theme-colors-background), 10%);
}
@mixin light {
background-color: darken(var(--theme-colors-background), 5%);
}
} }
} }
@ -100,11 +106,11 @@
border: 1px solid transparent; border: 1px solid transparent;
&:hover { &:hover {
background-color: darken(var(--button-bg), 5%); background-color: darken(var(--theme-colors-background), 5%);
} }
&:focus-visible { &:focus-visible {
background-color: darken(var(--button-bg), 10%); background-color: darken(var(--theme-colors-background), 10%);
} }
} }

View file

@ -70,6 +70,10 @@
fill: var(--theme-colors-foreground); fill: var(--theme-colors-foreground);
} }
.fill-contrast {
fill: var(--theme-colors-primary-contrast);
}
.fill-inherit { .fill-inherit {
fill: inherit; fill: inherit;
} }

View file

@ -224,11 +224,21 @@ export const AppIcon = {
export interface IconProps extends Omit<IconBaseProps, 'color' | 'fill' | 'size'> { export interface IconProps extends Omit<IconBaseProps, 'color' | 'fill' | 'size'> {
animate?: 'pulse' | 'spin'; animate?: 'pulse' | 'spin';
color?: 'default' | 'error' | 'info' | 'inherit' | 'muted' | 'primary' | 'success' | 'warn'; color?: IconColor;
fill?: 'default' | 'error' | 'info' | 'inherit' | 'muted' | 'primary' | 'success' | 'warn'; fill?: IconColor;
icon: keyof typeof AppIcon; icon: keyof typeof AppIcon;
size?: '2xl' | '3xl' | '4xl' | '5xl' | 'lg' | 'md' | 'sm' | 'xl' | 'xs' | number | string; size?: '2xl' | '3xl' | '4xl' | '5xl' | 'lg' | 'md' | 'sm' | 'xl' | 'xs' | number | string;
} }
type IconColor =
| 'contrast'
| 'default'
| 'error'
| 'info'
| 'inherit'
| 'muted'
| 'primary'
| 'success'
| 'warn';
export const Icon = forwardRef<HTMLDivElement, IconProps>((props, ref) => { export const Icon = forwardRef<HTMLDivElement, IconProps>((props, ref) => {
const { animate, className, color, fill, icon, size = 'md' } = props; const { animate, className, color, fill, icon, size = 'md' } = props;

View file

@ -11,8 +11,8 @@ export const defaultLight: AppThemeConfiguration = {
'scrollbar-track-background': 'transparent', 'scrollbar-track-background': 'transparent',
}, },
colors: { colors: {
background: 'rgb(255, 255, 255)', background: 'rgb(235, 235, 235)',
'background-alternate': 'rgb(245, 245, 245)', 'background-alternate': 'rgb(240, 240, 240)',
black: 'rgb(0, 0, 0)', black: 'rgb(0, 0, 0)',
foreground: 'rgb(25, 25, 25)', foreground: 'rgb(25, 25, 25)',
'foreground-muted': 'rgb(80, 80, 80)', 'foreground-muted': 'rgb(80, 80, 80)',
@ -20,7 +20,7 @@ export const defaultLight: AppThemeConfiguration = {
'state-info': 'rgb(0, 122, 255)', 'state-info': 'rgb(0, 122, 255)',
'state-success': 'rgb(48, 209, 88)', 'state-success': 'rgb(48, 209, 88)',
'state-warning': 'rgb(255, 214, 0)', 'state-warning': 'rgb(255, 214, 0)',
surface: 'rgb(245, 245, 245)', surface: 'rgb(225, 225, 225)',
'surface-foreground': 'rgb(0, 0, 0)', 'surface-foreground': 'rgb(0, 0, 0)',
white: 'rgb(255, 255, 255)', white: 'rgb(255, 255, 255)',
}, },