Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

756
Views
¿Cómo cambio el color del texto en SweetAlert2?

Quiero cambiar el color del 'título' en SweetAlert2. ¿Cómo puedo hacer eso? Gracias de antemano

 function CustomConfirm(title, message, type) { return new Promise((resolve) => { Swal.fire({ title: title, text: message, icon: type, showCancelButton: true, confirmButtonColor: '#d33', cancelButtonColor: '#6e7d88', confirmButtonText: 'Yes', cancelButtonText: "No" }).then((result) => { if (result.isConfirmed) { resolve(true); } else { resolve(false); } }); }); }
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Aquí está mi función final:

 Swal.fire({ title: "<h5 style='color:red'>" + title + "</h5>", text: message, icon: type, showCancelButton: true, confirmButtonColor: '#d33', cancelButtonColor: '#6e7d88', confirmButtonText: 'Yes', cancelButtonText: "No" })
about 4 years ago · Juan Pablo Isaza Report

0

Puede usar customClass o showClass para obtener la clase CSS para la ventana emergente y cambiar los colores en un archivo CSS desde allí.

Por ejemplo:

 function CustomConfirm(title, message, type) { return new Promise((resolve) => { Swal.fire({ customClass : { title: 'swal2-title' } title: title, text: message, ...

Luego en tu CSS

 .swal2-title { color: red; }
about 4 years ago · Juan Pablo Isaza Report

0

Puede intentar agregar este código en un CSS global:

 Swal.fire({ title: 'Testing Custom Styles', html: 'Good Job', icon: 'success' })
 .swal2-container.swal2-center>.swal2-popup{ background-color: #121212 !important; } .swal2-html-container, .swal2-title{ color: white !important; }
 <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.8/dist/sweetalert2.all.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!