This is very easily doable. The button click could be connected to a jquery click function which also includes an ajax call:
$('#id_button).click(function(){
$('body').css({'background-color': 'dark-gray'})
$.post({% url 'change-background-color' %}, {color: 'dark-gray'}, function(){
location.reload() // to refresh the page with new background color
})
})
# urls.py
add the following path
path('change-background-color/', views.change_background_color, name='change-background-color'),
# views.py
add the following view
def change_background_color(request):
color = request.POST.get('color')
# you could save the input to a model BackgroundColor as an instance or
update a current record.
# creating an instance
BackgroundColor.objects.create(bg_color=color)
return JsonResponse({'response': 'successfully changed color'})
Now all that is left is to ensure that your html has background color set to a variable referring to the Model instance where you saved the color in Ajax call
<body style='background-color:{{bg_color}}'></body>