js
Conheçendo a Lib Polished para manipular cores no JS
Achei bem legal aumentar e diminuir o tom de cores com a lib polished, ela auxilia bem a estilização de componentes com Styled Components
September 30, 20191 min read
Achei bem legal aumentar e diminuir o tom de cores com a lib polished, ela auxilia bem a estilização de componentes com Styled Components.
- Instalar
yarn add polished styled-components
- Utilizando
import styled from 'styled-components';
import { darken } from 'polished';
button {
background: #7169c1;
color: #fff;
border: 0;
border-radius: 4px;
overflow: hidden;
margin-top: auto;
display: flex;
align-items: center;
&:hover {
background: ${darken(0.03, '#7169c1')};
}
}
Veja funcionando:
Confira mais no site oficial: https://polished.js.org