Answer the question
In order to leave comments, you need to log in
Sass darken, lighten how to use correctly?
:root
--mainColor: #28bebd
--text-color: #FFF
--mainColorHover: rgba(var(--mainColor), 0.5)
.btn-info
background-color: var(--mainColor)
border-color: var(--mainColor)
&:hover, &:active, &:focus
background-color: var(--mainColorHover)
Answer the question
In order to leave comments, you need to log in
Where is lighten or darken in your code?
$color: #112233;
$darkenColor: darken($color, 10%);
$lightenColor: lighten($color, 10%);
$black: #000000
color: lighten($black, 10%)
color: darken($black, 10%)
When you write:
Css interprets it as:
Now read the rgba documentation. Can this format be used?
You need to rewrite the --mainColor property in a valid format for rgba:
--mainColorHover: rgba(var(--mainColor), 0.5)
--mainColorHover: rgba(#28bebd, 0.5)
--mainColor: 0, 0, 0 // или любой другой цвет rgb
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question