List or Library Buttons

I have had success with this code to help me change the color and text of my buttons. The icon isn't working in this case but I have made it work elsewhere so I will get that figured out eventually. What I don't understand is that after I upload a file, the button reverts to the purple default color and the default text. I have the ctrl.refresh(); in place but I suspect I need something else.

//Changing the button name; works upon first load but subsequent uploads reverts the button name back to Upload STEM
fd.spRendered(function() {
    fd.control('StemMediaUpload').ready(function(dt) {
    fd.control('StemMediaUpload').uploadingText = 'Uploading Stem Media';
    fd.control('StemMediaUpload').refresh();
        //dt parameter is the same as fd.control('StemMediaUpload')
        dt.buttons[1].text = 'Upload Stem Media Here';
        dt.buttons[1].class = 'btn-success';
        dt.buttons[1].icon = 'Upload';
            ctrl.refresh();
        
    });
});

ON FIRST LOAD
OnFirstLoad

DURING UPLOAD
Progress

AFTER UPLOAD
AfterUpload

Anyone out there see this and have a solution?

Thanks in advance.

Hello @shedev,

I'm sorry for delayed reply.

You can change the text of the upload button with this code:

    fd.control('ListOrLibrary1').ready(function(dt) {
        dt.buttons[1].text = 'Upload Stem Media Here';
        dt.uploadingText = 'Uploading Stem Media';
        dt.uploadText = 'Upload Stem Media Here';
        dt.refresh()
    });

The look of the button can be changed with CSS:

button.btn.btn-primary:nth-child(2) {
    color: #fff;
    background-color: #64a762;
    border-color: #62a775;
}