// @flow
import type {
  ColorPaletteColorNameKey,
  BrandProps,
} from './branding.proptypes';
import type { ThemeProps } from '../../types';
import type { PatchworkTheme } from '../../themes/theme.types';

export const getPaletteColor = (colorNameKey: ColorPaletteColorNameKey) => ({
  theme,
}: ThemeProps) => (colorNameKey ? theme.colorPalette[colorNameKey] : '');

export const getOutlineColor = (theme: PatchworkTheme) =>
  getPaletteColor('greyscale-light')({ theme });

export const getForegroundColor = ({
  theme,
  colorName,
}: {|
  ...BrandProps,
  ...ThemeProps,
|}) =>
  getPaletteColor(colorName || theme.defaultTextColor || 'greyscale-black')({
    theme,
  });
