Skip to content

Commit df4440c

Browse files
authored
Add setPrimaryColor function
1 parent 8b0fd34 commit df4440c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

usergui.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,24 @@ class UserGui {
732732
field.dispatchEvent(event);
733733
}
734734

735+
setPrimaryColor(hex) {
736+
const styles = `
737+
#header {
738+
background-color: ${hex} !important;
739+
}
740+
.nav-link {
741+
color: ${hex} !important;
742+
}
743+
.text-primary {
744+
color: ${hex} !important;
745+
}
746+
`;
747+
748+
const styleSheet = document.createElement("style")
749+
styleSheet.innerText = styles;
750+
this.document.head.appendChild(styleSheet);
751+
}
752+
735753
// Creates an event listener a GUI element
736754
event(name, event, eventFunction) {
737755
this.document.querySelector(`.field-${name}`).addEventListener(event, eventFunction);

0 commit comments

Comments
 (0)