0

i tried to make a condition on my component with sass @if and @else which is if background == var(--bg-danger) color return is white like this, but it just read white result not else condition

@mixin text-color
  @if (background: var(--bg-danger))
    color: var(--text-white)
  @else
    color: var(--text-dark)

hope you guys give me a solution, Thanks :)

kurakura
  • 166
  • 1
  • 13

1 Answers1

0

Your question has an answer: you need to have == inside if statement, not :.

If you want to check if a certain variable use a variable-exists() function, see: Checking if a variable is defined in SASS