Skip to content

Commit ab86ab5

Browse files
authored
Update README.md
1 parent e9938db commit ab86ab5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ An extended method for changing a button's background, text and border color.
3333
* @param {number} bgColor - Button's background color (RGB).
3434
* @param {number} [txColor] - Button text color (RGB). If omitted, the text colour will be automatically set to white or black depends on the background colour.
3535
* @param {boolean} [showBorder=1]
36+
* - `n` : The higher the value, the thicker the button's border when focused.
3637
* - `1` : Highlight when focused.
3738
* - `0` : No border displayed.
3839
* - `-1`: Border always visible.
40+
* - `-n`: The lower the value, the thicker the button's border when always visible.
3941
* @param {number} [borderColor=0xFFFFFF] - Button border color (RGB).
4042
* @param {number} [roundedCorner] - Rounded corner preference for the button. If omitted,
4143
* - For Windows 11: Enabled (value: 9).
@@ -51,33 +53,37 @@ SetColor(bgColor, txColor?, showBorder := 1, borderColor := 0xFFFFFF, roundedCor
5153
/** @type {_BtnColor} */
5254
btn := btn2 := btn3 := btn4 := unset
5355

56+
/* Rounded (Windows 11) or rectangle (Windows 10) button that will get its border on show when it's focused. */
5457
btn := myGui.AddButton("xm w300", "Rounded Button")
5558
btn.SetColor("0xaa2031", "FFFFCC",, "fff5cc", 9)
56-
btn.OnEvent("Click", btnClicked)
5759

60+
/* When you press the button each time, the background and text colours of the button swap around. */
5861
btnClicked(btn, *) {
5962
static toggle := 0
6063
static textColor := btn.TextColor
6164
static backColor := btn.BackColor
6265

6366
if (toggle^=1) {
64-
btn.TextColor := backColor
67+
btn.TextColor := btn.BorderColor := backColor
6568
btn.backColor := textColor
6669
} else {
67-
btn.TextColor := TextColor
70+
btn.TextColor := btn.BorderColor := TextColor
6871
btn.backColor := backColor
6972
}
7073
}
7174

75+
/* Rounded (Windows 11) or rectangle (Windows 10) button that’s got its border on show all the time. */
7276
btn2 := myGui.AddButton("yp wp", "Border Always Visible")
7377
btn2.SetColor(myGui.BackColor, "fff5cc")
7478
btn2.BorderColor := btn2.TextColor
75-
btn2.ShowBorder := -1
79+
btn2.ShowBorder := -5
7680

81+
/* Rectangle Button and show border outline when the button's focused. */
7782
btn3 := myGui.AddButton("xm wp", "Rectangle Button")
78-
btn3.SetColor("4e479a", "c6c1f7")
83+
btn3.SetColor("4e479a", "c6c1f7", 2)
7984
btn3.RoundedCorner := 0
8085

86+
/* Rectangle Button with no border outline. */
8187
btn4 := myGui.AddButton("yp wp", "No Focused Outline")
8288
btn4.SetBackColor("008080",, 0, 0,, "AFEEEE")
8389

0 commit comments

Comments
 (0)