Skip to content

Commit 959a193

Browse files
committed
fix foreground overloading
1 parent 987562e commit 959a193

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/figuro/ui/text.nim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ proc text*(node: Text, text: string) {.thisWrapper.} =
6161
proc font*(node: Text, font: UiFont) {.thisWrapper.} =
6262
node.font = font
6363

64-
proc foreground*(node: Text, color: Color) {.thisWrapper.} =
64+
proc foreground*(node: Text, color: Color) =
6565
node.color = color
6666

67+
template foreground*(color: Color) =
68+
mixin foreground
69+
this.foreground(color)
70+
6771
proc align*(node: Text, kind: FontVertical) {.thisWrapper.} =
6872
node.vAlign = kind
6973

tests/tinput2.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ proc draw*(self: Main) {.slot.} =
8282
skipOnInput ':'
8383
if this.disabled:
8484
fill this.fill.darken(0.4)
85-
this.foreground css"grey"
85+
foreground css"grey"
8686
proc overrideUpdateInput(this: Input, rune: Rune) {.slot.} =
8787
let isDigit = rune <=% Rune('9') and rune.char in {'0'..'9'}
8888
template currCharColon(): bool = this.text.runeAtCursor() == Rune(':')

0 commit comments

Comments
 (0)