Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hhanova authored and ujovlado committed Nov 7, 2024
1 parent 1a7f51a commit 7cc6ac8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion components/data-apps/general-design-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,22 @@ Use the following code for primary buttons; secondary buttons can be simple `st.
{: .image-popup}
![Screenshot - Save Data](/components/data-apps/general-design-guide/pic3.png)


```
def ChangeButtonColour(widget_label, font_color, background_color, border_color):
htmlstr = f"""
<script>
var elements = window.parent.document.querySelectorAll('button');
for (var i = 0; i < elements.length; ++i) {{
if (elements[i].innerText == '{widget_label}') {{
elements[i].style.color ='{font_color}';
elements[i].style.background = '{background_color}';
elements[i].style.borderColor = '{border_color}';
}}
}}
</script>
"""
components.html(f"{htmlstr}", height=0, width=0)
```

**Example**
```
Expand Down

0 comments on commit 7cc6ac8

Please sign in to comment.