我该如何在Lua中更改字体颜色?

我是 Lua 和 Corona 的新手,我在尝试改变字体颜色时遇到了困难。 color = { 163, 25, 12 } 并没有起作用。

myButton = widget.newButton{
        id = "open_id",
        left = 12,
        top = 360,
        label = "open",
        fontSize = 16,
    font = "Helvetica Neue Bold",
    color = { 163, 25, 12 },
        width = 294,
        height = 40,
        cornerRadius = 2,
        onEvent = onButtonEvent
    }
点赞
用户1613684
用户1613684

widget.newButton

labelColor

table. 这个 table 应该包含你的 label 的 颜色(red, green, blue, and alpha) 在其"默认(default)"和"悬停(over)"状态下. 以下是一个示例表格:

{ default={ 128, 255, 96, 255 }, over={ 0 } }
2012-12-17 08:31:12
用户1870706
用户1870706

试试这个:

myButton = widget.newButton{
    id = "open_id",
    left = 12,
    top = 360,
    label = "打开",
    fontSize = 16,
    font = "Helvetica Neue Bold",
    labelColor = { default = { 163, 25, 12 }, over = { 163, 25, 12} },
    width = 294,
    height = 40,
    cornerRadius = 2,
    onEvent = onButtonEvent
}

参考:

http://docs.coronalabs.com/api/library/widget/newButton.html

2012-12-24 03:36:51