How to use the @zendeskgarden/react-theming.getColor function in @zendeskgarden/react-theming

To help you get started, we’ve selected a few @zendeskgarden/react-theming examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zendeskgarden / react-components / packages / forms / src / styled / text / StyledTextInput.spec.js View on Github external
it('renders expected disabled styling', () => {
    const { container } = render();

    expect(container.firstChild).toHaveStyleRule('color', getColor('neutralHue', 800));
  });
github zendeskgarden / react-components / packages / forms / src / styled / radio / StyledRadioInput.spec.js View on Github external
it('renders expected disabled styling', () => {
    const { container } = render();

    expect(container.firstChild).toHaveStyleRule('background-color', getColor('neutralHue', 200), {
      modifier: `:disabled ~ ${StyledRadioLabel}::before`
    });
  });
github zendeskgarden / react-components / packages / buttons / src / styled / StyledAnchor.spec.tsx View on Github external
it('renders danger styling if provided', () => {
    const { container } = render();

    expect(container.firstChild).toHaveStyleRule('color', getColor('dangerHue'));
  });
github zendeskgarden / react-components / packages / tags / src / styled / StyledTag.spec.tsx View on Github external
it('renders using a default neutral hue', () => {
      const { container } = render();
      const color = getColor('neutralHue', 200);

      expect(container.firstChild).toHaveStyleRule('background-color', color);
    });
github zendeskgarden / react-components / packages / buttons / src / styled / StyledButton.ts View on Github external
let retVal;
  let hue;

  if (props.disabled) {
    hue = 'neutralHue';
  } else if (props.isDanger) {
    hue = 'dangerHue';
  } else {
    hue = 'primaryHue';
  }

  const shade = 600;
  const baseColor = getColor(hue, shade, props.theme);
  const hoverColor = getColor(hue, shade + 100, props.theme);
  const activeColor = getColor(hue, shade + 200, props.theme);
  const disabledBackgroundColor = getColor(hue, shade - 400, props.theme);
  const disabledForegroundColor = getColor(hue, shade - 200, props.theme);
  const boxShadowColor =
    props.focusInset && (props.isPrimary || props.isSelected)
      ? props.theme.palette.white
      : baseColor;
  const boxShadow = `
    ${props.focusInset ? 'inset' : ''}
    ${props.theme.shadows.md(rgba(boxShadowColor as string, 0.35))}`;

  if (props.isLink) {
    retVal = css`
      background-color: transparent;
      color: ${baseColor};

      &:hover {
        color: ${hoverColor};
github zendeskgarden / react-components / packages / tables / src / styled / StyledRow.tsx View on Github external
  background-color: ${props => props.isStriped && getColor('neutralHue', 100, props.theme)};
github zendeskgarden / react-components / packages / tables / src / styled / StyledRow.tsx View on Github external
${props =>
    props.isSelected &&
    `
  border-bottom-color: ${getColor('primaryHue', 300, props.theme)};
  background-color: ${getColor('primaryHue', 200, props.theme)};
  `};
github zendeskgarden / react-components / docs / src / components / mdx / MdxProvider.js View on Github external
  background-color: ${props => getColor('dangerHue', 300, props.theme, 0.4)};
  padding: ${props => props.theme.space.md};
github zendeskgarden / react-components / docs / src / components / mdx / MdxProvider.js View on Github external
  background-color: ${props => getColor('successHue', 300, props.theme, 0.4)};
  padding: ${props => props.theme.space.md};
github zendeskgarden / react-components / packages / tags / src / styled / StyledTag.ts View on Github external
const colorStyles = (props: IStyledTagProps & ThemeProps) => {
  let backgroundColor;
  let boxShadowColor;
  let foregroundColor;
  let closeColor;

  if (props.hue) {
    const shade = props.hue === 'yellow' ? 400 : 600;

    backgroundColor = getColor(props.hue, shade, props.theme);
    boxShadowColor = getColor(props.hue, shade, props.theme, 0.35);

    if (props.hue === 'yellow' || props.hue === 'lemon') {
      foregroundColor = getColor('yellow', 800, props.theme);
    } else {
      foregroundColor = readableColor(
        backgroundColor!,
        props.theme.colors.foreground,
        props.theme.colors.background
      );
    }
  } else {
    backgroundColor = getColor('neutralHue', 200, props.theme);
    boxShadowColor = getColor('neutralHue', 600, props.theme, 0.35);
    foregroundColor = getColor('neutralHue', 700, props.theme);
    closeColor = getColor('neutralHue', 600, props.theme);