Reputation: 458
By default the colour is white. Is it possible to change modal background color of sweetalert2?
I have tried it to change with CSS, as I follow on the other question here and here, like this :
.sweet-alert
{
background-color: #2f2f2f96;
}
but I got nothing,
i use the sweetalert question feature
Swal.mixin({
input: 'text',
confirmButtonText: 'Next →',
showCancelButton: true,
progressSteps: ['1', '2', '3']
}).queue([
{
title: 'Question 1',
text: 'Chaining swal2 modals is easy'
},
'Question 2',
'Question 3'
]).then((result) => {
if (result.value) {
Swal.fire({
title: 'All done!',
html:
'Your answers: <pre><code>' +
JSON.stringify(result.value) +
'</code></pre>',
confirmButtonText: 'Lovely!'
})
}
})
I wish i can change the modal colour to grey
Upvotes: 2
Views: 6450
Reputation: 7949
You have to add background in Swal function. It will Works for you.
Swal.mixin({
input: "text",
confirmButtonText: "Next →",
showCancelButton: true,
background: 'gray',
progressSteps: ["1", "2", "3"]
})
.queue([
{
title: "Question 1",
text: "Chaining swal2 modals is easy"
},
"Question 2",
"Question 3"
])
.then(result => {
if (result.value) {
Swal.fire({
title: "All done!",
background: 'gray',
html:
"Your answers: <pre><code>" +
JSON.stringify(result.value) +
"</code></pre>",
confirmButtonText: "Lovely!"
});
}
});
Upvotes: 5