Skip to content

Using tailwind colors in javascript #18141

Answered by wongjn
dirkcremers asked this question in Help

You must be logged in to vote

You could do:

const indicatorColour = computed(() => {
  switch (ref.value) {
    case 'alert':
      return 'var(--color-red-400)';
    case 'warning':
      return 'var(--color-orange-400)';
    default:
      return 'var(--color-sky-500)';
  }
});

Replies: 1 comment 4 replies

You must be logged in to vote
4 replies
@dirkcremers

@wongjn

wongjn May 24, 2025
Collaborator

Answer selected by dirkcremers
@dirkcremers

@wongjn

wongjn May 24, 2025
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants