如何更改Lua中的字体颜色?

时间:2012-12-16 20:58:25

标签: fonts lua corona

我是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
    }

2 个答案:

答案 0 :(得分:2)

试试这个:

myButton = widget.newButton{
    id = "open_id",
    left = 12,
    top = 360, 
    label = "open",
    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

答案 1 :(得分:1)

http://developer.coronalabs.com/reference/index/widgetnewbutton

labelColor 表。此表应在其“默认”和“超过”状态下保留标签颜色的红色,绿色,蓝色和Alpha通道。这是一个示例表: {default = {128,255,96,255},over = {0}}