Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#615·polished

Readable color returnIfDarkColor isn't working

Author: majkl-zumberiCreated May 4, 2022Updated Oct 18, 2023
Labelsunconfirmed bug
  • polished version: ^4.2.2
  • JSS-in_CSS library and version: styled-components ^5.1.1
  • Any relevant JS library and version: React 17.0.2, nextjs 12.1.0

Mixin/Helper/Shorthand Usage

javascript

export const WelcomeContentTitle = styled.h1`
  color: ${(props) =>
    readableColor(
      props.theme.colors.secondary,
      props.theme.colors.white,
      props.theme.colors.tertiary
    )};
`

What You Are Seeing

i provide #f4d449 as secondary #FFF as white and #2b3399 as tertiary

returns the default color returnIfDarkColor

What You Expected To See

returns #000 instead of #2b3399

Source: styled-components/polished

View original on GitHubView discussion on GitHub